BookmarkSubscribeRSS Feed
GVeers
Calcite | Level 5
Hey all, I have an Access database that with a number of fields that use "-9999" as a "missing" value. I am going to read the data into SAS using Proc Import (I'm slightly scared of other methods) and then use a Data statement to translate the -9999 to the missing character.

This seems like a clunky way to do things, particularly with the sheer number of variables that are set up in this fashion. Is this the best way to do it, or is there another way (maybe ditch the Proc Import or streamline the Data statement)?

Thank you very much in advance for any help you can offer.
4 REPLIES 4
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Here is some DATA step code to consider using, an explicit array to address numeric variables only:

ARRAY a_num (*) _numeric_;
do i=1 to dim(a_num);
if = -999 then = .;
end;

Scott Barry
SBBWorks, Inc.
GVeers
Calcite | Level 5
I see. Thank you very much for the reply.
ChrisNZ
Tourmaline | Level 20
you can use Scott's code this way:

ARRAY a_num (*) _numeric_;
do i=1 to dim(a_num);
if a_num(i) = -9999 then a_num(i) = .;
end;

and all numeric variables are handled automatically without your having to name them.
ballardw
Super User
I would seriously look into creating one or more INFORMATS using Proc Format and INVALUE.

Something like this would set all values less than 0 to missing. The only issue is assigning the informat while using Proc Import. (Hint the log should contain a bunch of INFORMAT, FORMAT statements after the first run. Copy the code from the Log to the editor and apply as needed)

Proc format;
invalue groupval 0- high= _same_
other= .;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2193 views
  • 0 likes
  • 4 in conversation