BookmarkSubscribeRSS Feed
lizzy28
Quartz | Level 8

I tried to format a numeric variable into two categories. But when I ran the frequencies for it, the program treated 'OTHER' missing. Here is my syntax:

proc format;

    value $process

   '01'-'03'='Done'

   OTHER='Not finished';

   value outcome

   1-2='Done'

   OTHER='Not participating';

   run:

proc freq;

    format var_process $process.;

    format general_outcome outcome.;

    tables general_outcome*var_process;

run;

For general_outcome, only 'Done' was tabulated. When missing values were included, 'Not participating' was tabulated

Has anyone experienced this?

Thank you!

3 REPLIES 3
Astounding
PROC Star

By default, missing values are tallied separately by PROC FREQ.  If you want them as part of the table, add the MISSING option:

tables general_outcome * var_process / missing;

The addition of a FORMAT statement doesn't affect the process.

lizzy28
Quartz | Level 8

Thank you.

But since I set 'OTHER' values as 'Not participating', there is no missing values in my data. Only two values include 'Done' and 'Not participating' (value outcome 1-2='Done' OTHER='Not participating';). The problem is SAS treated 'OTHER' values as missing while it should treat other values as 'Not participating'.

Astounding
PROC Star

No, that's not quite right.  Adding a format does not change what is in your data.  Not in any way.  You still have missing values in your data.

Adding a format changes what characters print, instead of printing the actual values in your data.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 1824 views
  • 1 like
  • 2 in conversation