Hi @ambreen,
It's the FORMAT statement in the PROC PRINT step:
You are using the syntax
FORMAT format_name1 label1. format_name2 label2. ...
but the correct syntax (see documentation: FORMAT Statement) is
FORMAT variable_name1 format_name1. variable_name2 format_name2. ...
So, you need to look into dataset cdc.hw7 (or its copy, fda) to find out the names of the four variables to be formatted. You may want to create a list of all variables in the dataset by means of PROC CONTENTS:
proc contents data=fda;
run;
Depending on the variable names (which could be, say, sex, occup, jprev and age), your FORMAT statement might look like
format sex Gender. occup Occupation. jprev JudgedPreviously. age Age.;
There is a remote possibility that one or more of the four variables are in fact character variables (see column "Type" in the PROC CONTENTS output). This would cause an error message in the log when you submit the PROC PRINT step, e.g.:
ERROR: You are trying to use the numeric format GENDER with the character variable sex in data set CDC.HW7.
Only in this case you would need to modify the corresponding format definition in the PROC FORMAT step (and rerun that step), e.g.:
VALUE $Gender '1'= 'Female' '2' = 'Male';
and use $Gender. instead of Gender. in the FORMAT statement.
Great. So, the suggested solution in the first part of my response should work for you. Have you tried it?
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.