1. Write a SAS program to do the following in order of the question numbers: a. Create a SAS library, E11 that connects to the folder U:\STA575\Exam1. You must first create a folder Exam1 inside STA575 on your U drive and place fish.sas7bdat inside the folder. b. Include a global options statement, where firstobs = 21 and obs = 35. c. Write a data step that reads observations from the SAS data set fish and creates a temporary SAS data set one. Include an option keep= Species Weight Height in fish.sas7bdat data set. d. By using appropriate procedure on the fish.sas7bdat data set, answer the following questions: • Number of variables and the number of observations in the data set, • the date the data was created, • the size of the data set in kilo bytes, and • the number of character variables. e. Using local options, print the first five observations in one.sas7bdat data set in question c. f. Print the data set work.one. How many observations are printed? How many observations are in work.one? Explain the reason behind the number of printed observations. 2. Write a SAS program to do the following in order of the question numbers: a. Reset the global options in question (1b) to their default values. b. Write a data step that reads observations from the SAS data set fish and creates two temporary SAS data sets Type1 and Type2. Include the following ‘if’ statements: If Species = ‘Bream’ then output Type1; If Species=’Roach’ then output Type2; c. Using XLSX engine, write a libname statement that creates (or links) a new Excel file Fish.xlsx workbook in the folder Exam1 created in question (1a). Use the library reference E12. d. Using worksheet name Type1, write a data step that reads the Type1 SAS data set in (b) into the Excel workbook Fish.xlsx in 2(c). e. Using worksheet name Type2, write a data step that reads the Type2 SAS data set in (b) into the Excel workbook Fish.xlsx in 2(c). f. How many observations are in Type1 and Type 2 data sets in (b)? My Code: libname E11 'U:\STA575\Exam1'; data one; set E11.fish; options firstobs = 21 obs = 35; keep Species Weight Height; run; proc contents data = one; run; proc print data = one(firstobs = 1 obs = 5); run; proc print data = one; run; goptions reset; data type1 type2; set E11.fish; if (Species ='Bream') then output type1; if (Species='Roach') then output type2; run; libname E12 xlsx'U:\STA575\Exam1\Fish.xlsx'; data E12.Type1; set type1; run; data E12.Type2; set type2; run;
... View more