I am doing a proc freq to count the number of missing and not missing per variable:
My code:
proc format; value $missfmt ' '='Missing' other='Not Missing'; value missfmt . ='Missing' other='Not Missing';
proc freq data=have; format _NUMERIC_ missfmt.; tables _NUMERIC_ / missing missprint nocum;
What I get is a table for each variable (only one variable - sales - is shown below)
The FREQ Procedure
Sales Frequency Percent
------------------------------------
Missing 10153881 47.32
Not Missing 11304829 52.68
What I want is to make sure that the observations that are zero are counted as 'missing' or other class but not as 'not missing'. How can I do this?
@Satori wrote:
What I want is to make sure that the observations that are zero are counted as 'missing' or other class but not as 'not missing'. How can I do this?
Modify your format to include 0 as missing.
proc format;
value missfmt .,0 ='Missing' other='Not Missing';
run;
From now on, please include your SAS code in a code box, as I did above, by clicking on the "little running man" icon and then pasting your code into the window that appears.
@Satori wrote:
What I want is to make sure that the observations that are zero are counted as 'missing' or other class but not as 'not missing'. How can I do this?
Modify your format to include 0 as missing.
proc format;
value missfmt .,0 ='Missing' other='Not Missing';
run;
From now on, please include your SAS code in a code box, as I did above, by clicking on the "little running man" icon and then pasting your code into the window that appears.
Zero frequency is not missing frequency. Missing frequency menas you do not know how many times a value is observed. Zero frequency means you do know that it was observed zero times.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.