Question: Use %LET to create a macro variable named ClassAge , assigning to it a value of Pre-K 4 . Read the data set from the
Use %LET to create a macro variable named ClassAge, assigning to it a value of Pre-K 4.
Read the data set from the file '/folders/myfolders/Week6/School 1 final.csv' and name it final. Then use IF to subset with the macro variable &ClassAge. Name the subset as ClassAge_final. Print it using the macro variable in TITLE.
Create a macro named average with two parameters category and question. In the macro, firstly apply PROC MEANS for the data set final to calculate the mean of &question by &category. In the PROC MEANS, use option NOPRINT, and let OUT=averagescore. Then apply PROC PRINT to print the data averagescore using the macro variables in the TITLE.
Invoke the macro %average(category=Gender, question=f1).
Invoke the macro %average(category= ClassAge, question=f3).
Create a macro named class with one parameter category. In the macro, use %IF &category =Gender %THEN %DO; PROC MEANS for the data final to calculate the mean of the variable f1 by &category. %ELSE %IF &category =ClassAge %THEN %DO; PROC MEANS for the data final to calculate the mean of the variable f2 by &category.
Call the macro %class(category=Gender)
Call the macro %class(category=ClassAge)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
