BookmarkSubscribeRSS Feed
LisaM_Yarnell
Calcite | Level 5

Hi there,

SAS doesn't have a "data view" and a "variable view" the way that SPSS does, and so to my knowledge, there's no way to look up what values have been assigned to missing in SAS, such as -9s or -8s?

This might be an issue if one has read in data from SPSS, or used StatTransfer to transfer the file from another program into SAS.

Is there a way to get SAS to tell me what values (such as -9s or -8s) it is recognizing as missing?  There is PROC CONTENTS, but to my knowledge, that doesn't have data on what is coded as what.

Thanks in advance for any help you can provide!

Lisa

2 REPLIES 2
Tom
Super User Tom
Super User

SAS has 28 special missing value ., ._, .a, .b, ..... ,.z that work for all numeric variables.  You do not need to enter dummy valid numbers like 9 or -9  as you would in SPSS.  So you do not need to somehow tell it later to treat these as something other than they appear.

If you already have read your data into variables then you can recode them using a data step.

data new; set old ;

  if x=-9 then x=.; else if x=-8 then x=.a;

run;

If you are just using the data as categories then in you might be able to just fix it using formats.

proc format ;

  value miss89f -9,-8 = ' ' other=[f2.];

run;

proc freq data=old;

  format x miss89f.;

  tables x;

run;


Tom
Super User Tom
Super User

If your data is coded then you would normally expect to see in the PROC CONTENTS output ( or in the interactive VAR window) the format that is attached to the variable.  You can then use PROC FORMAT to view the definition of the format.  Note that for SAS only the name of the format is permanently attached to the variable in the dataset.  The formats themselves are stored in format catalogs.

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
  • 1014 views
  • 0 likes
  • 2 in conversation