BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Satori
Quartz | Level 8

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?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller
WeiChen
Obsidian | Level 7

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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 490 views
  • 3 likes
  • 3 in conversation