This scenario uses the
Certadv.Staff data set. Write a SAS program that does the following:
-
Define a macro variable named Job
with a value of Analyst
.
-
Use a DATA step to create a temporary
data set Work.Staff from the data set Certadv.Staff. Within this DATA
step, do the following:
-
Read in only those rows from the
Certadv.Staff data set that contain the text specified in the macro
variable Job.
-
Create a new column that keeps
a running total of Salary. Code:Total+Salary;
-
Create a Count variable and increment
its value by one for each observation. Code: Count+1;
-
Create a new macro variable named
Avg. The value of Avg is the value of Total divided by the value of
Count. Format Avg as DOLLAR9.
-
Use PROC PRINT to print Work.Staff.
The output should include these elements:
-
a title with the value of the macro
variable Job followed by the constant text 'Staff'.
-
a footnote with the constant text 'Average
Salary:' followed by the value of the macro variable Avg.