Hello!
I am trying to manipulate the dataset in SAS. I'd like to change my numerical values such as 5 to a . (period) to represent the missing data so it won't count.
I am not sure how to go about it. Please help!
I'm new to SAS.
data more_vars_and_people;
input x y z;
cards;
12 5 9
1 5 30
7 5 20
8 2 3
;
run;
DATA more_vars_and_people;
modify more_vars_and_people;
if y=5 then y=.;
run;This is an example..
Hope it helps
Hello!
Thank you for the response!
Hm, I tried creating a new data set (new2) and coding that way. I'm not sure what I am doing wrong.
here is my code.... I am trying to recode all the -99 into . so that it does not count as my data and SAS will consitute it as missing.
q1a = variable
data new2; set new;
if q1a<0 THEN q1a=.; run;
~ SASbeginner
Thank you for the response!
I want to recode just -99 to .
This what I am inputting:
Hi, what does the log say?
The sample code below correctly recoded either numeric or character variables to missing from -99.
data test;
numeric=-99;
char='-99';
if numeric=-99 then numeric=.;
if char='-99' then char='';
run;
proc print noobs; run;
Hi fabdi,
There is nothing worng with the code as such. The only concern i have is the part where u mention.
"q1a = variable ". Can you elaborate on this part.
else everthing is correct.
Thank You.
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.