Hi,
I am trying to create a new variable from information already in my data set. I used an if then statement to do so, however the code is reading but it will not make it a new variable in my data set. When I try to use a Acecutoff variable later in my code, it tells me it is not found. When I do proc print then it variable has a a triangle looking shape with an A inside of it, not a circle with a number let the rest. It would be greatly appreciated if someone could tell me where I am going wrong.
data aces2;
set b.aces;
if ACE_SCORE >=4.0 then
Acecutoff="4 or greater";
else if ACE_SCORE <3.0 then
Acecutoff="less than 4";
run;
proc print;
run;
Your code looks fine (other than not handling all possible values). Are you sure you are looking at the right dataset? Did you check your log for errors?
data aces ;
id+1;
input ace_score ;
cards;
1
2
3
4
5
;
data aces2;
set aces;
if ACE_SCORE >=4.0 then Acecutoff="4 or greater";
else if ACE_SCORE <3.0 then Acecutoff="less than 4";
run;
proc print;
run;
ace_ Obs id score Acecutoff 1 1 1 less than 4 2 2 2 less than 4 3 3 3 4 4 4 4 or greater 5 5 5 4 or greater
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.