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

When I open a SAS dataset, there is a numeric variable (var1) which shows character values  like C, M when opened

 

Also,

There is a code that queries that dataset and that numeric variable var1 as below

 

data test;

    set myds;

    if var1 = .C then newvar=10;

run;

 

Proc contents show that there is no format applied on that column. That variable var1 is num 8.

 

What does this .C mean and why are character variables shown in a numeric field?

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

In addition to the normal missing value SAS supports 27 special missing values which you represent in code as ._, .A, .b,  up to  .z.

You can use them to make different categories of missing values.  For example if you had a survey question you might use one to mean question not asked, another to mean respondent refused to answer, another to mean respondent doesn't know the answer, etc.

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

Please see the code below. SAS interprets .C, .A and such as missing values. However, they are missing as PROC FREQ reveals.

 

data test;
    a=.A;output;
    a=.;output;
    a=.B;output;
run;

data test2;
    set test;
    if a=.B then dummy=1;
    else dummy=0;
run;

proc freq data=test;
run;
Sanjay_M
Obsidian | Level 7

Thanks for the quick response.

Is this a feature? why will we need Character missing values?

It is pretty confusing

Tom
Super User Tom
Super User

In addition to the normal missing value SAS supports 27 special missing values which you represent in code as ._, .A, .b,  up to  .z.

You can use them to make different categories of missing values.  For example if you had a survey question you might use one to mean question not asked, another to mean respondent refused to answer, another to mean respondent doesn't know the answer, etc.

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
  • 3 replies
  • 915 views
  • 2 likes
  • 3 in conversation