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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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