BookmarkSubscribeRSS Feed
devarayalu
Fluorite | Level 6

data one;

infile datalines missover;

input age;

if age is missing then age=9999;

else age=age;

cards;

8

01

20

0

1

2

;

proc print;

run;

3 REPLIES 3
Quentin
Super User

Hi,

You probably want the missing FUNCTION.  Try:

if missing(age) then age=9999;

Also I would suggest you use SAS special missing values instead of numeric codes.  So:

if missing(age) then age=.S;

--Q.


BASUG is hosting free webinars Next up: Mike Raithel presenting on validating data files on Wednesday July 17. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
cwilson
Calcite | Level 5

Also, the "is missing" syntax is used with the "where" clause, as in Proc SQL or as a filter on Proc freq, for example.

Proc freq data = . . . ;

where age is missing ;

tables . .  . ;

In a DATA step, use:

if age = . then age = 9999 ;

(and you really don't need the else clause)

ballardw
Super User

Or

if missing(age) then age=9999;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1688 views
  • 0 likes
  • 4 in conversation