BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Kevin1712
Calcite | Level 5

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
     
nbrFrequencyPercentCumulative FrequencyCumulative Percent
-----------------------------------------------------------------------------
One120.00120.00
Two120.00240.00
Three120.00360.00
Four120.00480.00
Five120.005100.00
     
Frequency Missing = 3

 

 

Why is this happening and what do I do to change the output?

 

Thanks in advance

 

K.

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
Diamond | Level 26

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:

 

other.png

 

Hope this helps,

Cynthia

View solution in original post

2 REPLIES 2
Cynthia_sas
Diamond | Level 26

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:

 

other.png

 

Hope this helps,

Cynthia

Kevin1712
Calcite | Level 5

Thanks for your help!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2311 views
  • 0 likes
  • 2 in conversation