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

18.

The following raw data records contain the age of each individual customer. A value of 999 was used to represent a missing age value. Write an instream DATA step that will read the records and replace the value 999 with a period '.'

18 30 25 999 42 36 999

 

data ex18;
input age @@;
if age=999 then (I don't know what to put here);
datalines;
18 30 25 999 42 36 999
;
run;

 

help!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

You've been almost there.

A dot is how SAS prints by default a missing value for a numerical variable. You can also use a dot in SAS syntax to assign missing to a SAS numerical variable.

data ex18;
  input age @@;
  /*if age=999 then (I don't know what to put here);*/
  if age=999 then age=.;
  datalines;
18 30 25 999 42 36 999
;
run; 

 

View solution in original post

1 REPLY 1
Patrick
Opal | Level 21

You've been almost there.

A dot is how SAS prints by default a missing value for a numerical variable. You can also use a dot in SAS syntax to assign missing to a SAS numerical variable.

data ex18;
  input age @@;
  /*if age=999 then (I don't know what to put here);*/
  if age=999 then age=.;
  datalines;
18 30 25 999 42 36 999
;
run; 

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 530 views
  • 0 likes
  • 2 in conversation