Below are the data for the national electrical energy use per capita in the United States in million kilowatt-hours from 1920 to 1970. The data are presented in two forms. The first is a form that can be read by R and the second is a form that can be read by SAS. For the R version, simply copy and paste the code into Notepad (or other text editor), and then save the file in your R_Working_Directory as a txt file. Your R program for this assignment will ask you to select a data set, and you will then select this file when prompted. To use the SAS version, you will need to copy and paste the data directly into your program in the SAS editor.

# FIRST IS THE R VERSION

# DATA SET... ELECTRIC ENERGY USAGE 1920-70 IN THE USA
year electricalusage
1920 339
1921 347
1922 359
1923 368
1924 378
1925 396
1926 430
1927 446
1928 463
1929 502
1930 547
1931 583
1932 601
1933 600
1934 629
1935 677
1936 735
1937 805
1938 853
1939 897
1940 952
1941 986
1942 1022
1943 1070
1944 1151
1945 1229
1946 1329
1947 1438
1948 1563
1949 1684
1950 1845
1951 2021
1952 2186
1953 2369
1954 2573
1955 2773
1956 2989
1957 3198
1958 3389
1959 3618
1960 3854
1961 4019
1962 4259
1963 4442
1964 4703
1965 4933
1966 5265
1967 5577
1968 6057
1969 6571
1970 7066

 

* BELOW IS THE SAS VERSION;

************************************************************
*** DATA SET... ELECTRIC ENERGY USAGE 1920-70 *****
************************************************************;

DATA POWER;
INPUT YEAR 1-4 ELECTRI 6-10;
CARDS;
1920 339
1921 347
1922 359
1923 368
1924 378
1925 396
1926 430
1927 446
1928 463
1929 502
1930 547
1931 583
1932 601
1933 600
1934 629
1935 677
1936 735
1937 805
1938 853
1939 897
1940 952
1941 986
1942 1022
1943 1070
1944 1151
1945 1229
1946 1329
1947 1438
1948 1563
1949 1684
1950 1845
1951 2021
1952 2186
1953 2369
1954 2573
1955 2773
1956 2989
1957 3198
1958 3389
1959 3618
1960 3854
1961 4019
1962 4259
1963 4442
1964 4703
1965 4933
1966 5265
1967 5577
1968 6057
1969 6571
1970 7066
;
DATA POWER;SET;
LELECTRI=LAG(ELECTRI);