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

Hello,

I have a SAS dataset (dataset name= Gold) with special missing (.A .B .D) in 400 various variables (such as Age, Weight, Sex, Race). 

A colleague who uses SPSS will be using this dataset and when I export it to a CSV file, the special missing appears as text (A B D etc). 

I will appreciate help converting all the special missing to regular missing (.) in the various variables. 

Thanks

Sackey 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

You can use an ARRAY to go through all variables and convert them to regular missing.

 

Something like this

 

data want;
    set have;
    array check a b c d e; /* Your actual variable names go here */
    do i=1 to dim(check);
        if missing(check(i)) then check(i)=.;
    end;
run;
--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

You can use an ARRAY to go through all variables and convert them to regular missing.

 

Something like this

 

data want;
    set have;
    array check a b c d e; /* Your actual variable names go here */
    do i=1 to dim(check);
        if missing(check(i)) then check(i)=.;
    end;
run;
--
Paige Miller
Shmuel
Garnet | Level 18

If you have in a column a character like 'A'  - how can you know if it is the '.A' in origin (i.e. missing value) or the real 'A' character ?

 

In case all thus variables shuould be numeric then you can check for numbers (digits) otherwise it is a missing value.

 

sackey
Calcite | Level 5
Thank you for your input. In this dataset, there are are no characters like 'A' which could be mixed up with a '.A' missing.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 689 views
  • 0 likes
  • 3 in conversation