Section 1: Multiple Choice
1. What change to the program will correct the error?
2) The value 110700 is stored in a numeric variable. Which one of the following SAS formats is used to display the value as $110,700.00 in a report?
3) The following SAS DATA step is submitted:
libname temp 'C:\Users\SAS\Datasets';
data temp.report;
set sashelp.houses;
newvar = price * 1.04; run;
Which one of the following statements is true regarding the program above?
4) Which of the following actions occurs at the beginning of an iteration of the DATA step?
5) A raw data record is shown below:
07Jan2002
Which one of the following informats would read this value and store it as a SAS date value?
6) The following SAS program is submitted:
data newdata;
set sasdata.origin (firstobs = 75 obs = 499);
run;
The SAS data set SASDATA.ORIGIN contains 1000 observations. How many observations does the ALLOBS data set contain?
7) The observations in the SAS data set TEST are ordered by the values of the variable SALARY. The following SAS program is submitted:
proc sort data = test out = testsorted;
by NAME;
run;
Which one of the following is the result of the SAS program?
8) Which one of the following SAS statements correctly renames two variables?
9) Which of the following statements is true regarding BY-group processing?
C BY-group processing is preferred when you are categorizing data that contains few variables.
10) In the following program, complete the statement so that the program stops generating observations when Distance reaches 250 miles or when 10 gallons of fuel have been used.
data work.go250;
set perm.cars;
do gallons=1 to 10 ... ;
Distance=gallons*mpg;
output;
end;
run;
Section 2: Coding
Q.11. Create a folder “final624” in your desktop and create library ‘final’ to link that folder. Copy and paste the output from Log window showing successful creation of final library in final624 folder. This library will be referred throughout this homework.
Q.12. (a) Create sas data demo in final library which reads the following data(copy and paste the following data after the Datalines or Cards statement, do not modify the data). The variables used (in order) are: St_Name, ID, Name, Income, DOB, Race, and City.
Palm Street 2 Calvin 123456 10/05/1988 H Chesapeake
Cherry Blvd. 4 Smithsonian 83456 11/23/1982 AA Virginia Beach
Lincoln Avenue 6 Anjali 134500 07/07/1979 A Portsmouth
8 Smith 123456 06/07/1977 W Suffolk
Fairfield Rd. 9 Alexa 88000 05/23/1987 W
Print the data, the printed demo data should look like (Pay attention to the column headings):
(If you are not able to create the data demo, you can still use the demo data (provided in BB), and print it to look like below. If you use the given demo SAS data, you will lose 5 points of creating the data from the first part.)
(b) Create demo1 data by using demo data and add a column Tax which shows 10% tax on Income. Also, rename the Race as Ethnicity and label Str_name as Street Name. The printed output should look like:
(c) Create a permanent format ethn such that
H= Hispanics
AA= African Americans
A= Asians and
W=Whites
Apply this ethn format to demo1 data. The final printout after applying ethn format should look like:
(d) Export demo1 data as demo.csv in the final folder of your desktop. Print the log showing that it is successfully exported.
Q.13. Dept1, dept2 and cost data have patient information from different years. Patient from one year is different from another year but patient with same ID within the year is the same.
(a) Import 3 comma separated value (.csv) data sets- dept1.csv, dept2.csv, and cost.csv in final library as dept1, dept2, and cost data sets. Print the log showing that these files are successfully imported.
(if you are not able to import these files, you can still use SAS files from BB, but you won’t get 2 points of importing these files).
(b) Concatenate dept1 and dept2 data and create new data dept1_2. dept1_2 data should look like this: (Hint: you can review the lecture note Week 8, Data Manipulation …, page 36).
(c) Create final_cost data by match merging of dept1_2 and cost data. final_cost should look like (only a part of the final_cost is printed below). The final_cost data will have 54 observations similar to the cost data but it has one more column, Gender, than the cost data.
[2+2]
(d) Create data final_cost1 by using final_cost. In final_cost1 data there will be one column for Total_Cost which accumulates the cost for each patient over different visits. The final_cost1 data should look like (only a part is presented). (Hint: first. is helpful, you can also review the WEEK 8 lecture notes on Data Manipulations.). [1+3]
(if you were unable to create final_cost data in part (c ), you can use the given final_cost data)
(e) Modify the code in part (d) to create an output which only shows the Total_cost for each patient with the number of visits. The output should look like (Hint: Last. is a useful command).
(f) Create a report (ditto) by including the columns Year, Patient_ID, Gender, visit, Cost and Tax. using final_cost data. Tax is computed variable which is 8% of Cost. Also, for each Patient_ID, total tax and total cost is shown.
(Hint: BREAK, RBREAK, COMPUTE statements, BREAK statement with Header=Style are useful in PROC REPORT, check header and footnotes carefully)
Q.14. A person invested $8,000 in year 2017. If the bank gives 1% interest every month, when the total accumulated money will cross $100,000 threshold. Please, provide the exact year and month by coding (Hint: Use Do loop; RETAIN statement is useful).
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of