Hi,
I have created a format called knums and applied it to a test table.
Proc Format;
value knums
1 = "One"
2 = "Two"
3 = "Three"
4 = "Four"
5 = "Five"
Other = "Other Numbers";
Run;
Data Test;
format nbr knums.;
nbr=1; output;
nbr=2; output;
nbr=.; output;
nbr=5; output;
nbr=4; output;
nbr=.; output;
nbr=3; output;
nbr=.; output;
Run;
When I run a Proc Freq against the table I get missing values returned rather than the value set in the format.
Proc Freq Data=Test;
Table nbr;
Run;
The FREQ Procedure | ||||
nbr | Frequency | Percent | Cumulative Frequency | Cumulative Percent |
----------------------------------------------------------------------------- | ||||
One | 1 | 20.00 | 1 | 20.00 |
Two | 1 | 20.00 | 2 | 40.00 |
Three | 1 | 20.00 | 3 | 60.00 |
Four | 1 | 20.00 | 4 | 80.00 |
Five | 1 | 20.00 | 5 | 100.00 |
Frequency Missing = 3 |
Why is this happening and what do I do to change the output?
Thanks in advance
K.
Hi:
You have to tell PROC FREQ that you want to see the missing values in the tabular output by using the MISSING option:
Proc Freq Data=Test;
Table nbr /missing;
Run;
Then the format that's been permanently assigned in the DATA step program will show the Other Numbers category:
Hope this helps,
Cynthia
Hi:
You have to tell PROC FREQ that you want to see the missing values in the tabular output by using the MISSING option:
Proc Freq Data=Test;
Table nbr /missing;
Run;
Then the format that's been permanently assigned in the DATA step program will show the Other Numbers category:
Hope this helps,
Cynthia
Thanks for your help!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.