Hi,
I have data with whole numbers values (34, 78...) in all hospitals except for one who has the numbers as (16%, 65% which ended in having .16 and .65 in the final data set...). Is there a way to change those values to whole numbers such as 16 and 65?
Thank you
Even though you wrote the WHERE statement after the IF statement is will actually apply to the data as it is read. So your resulting dataset will only have the data from the one hospital.
If you did not intend to subset the data then instead include the extra test in the IF condition.
data new;
set test;
if variable<1 and hospital = 'abc' then variable=variable*100;
run;
Even though you wrote the WHERE statement after the IF statement is will actually apply to the data as it is read. So your resulting dataset will only have the data from the one hospital.
If you did not intend to subset the data then instead include the extra test in the IF condition.
data new;
set test;
if variable<1 and hospital = 'abc' then variable=variable*100;
run;
@mayasak wrote:
if variable<1 then variable=variable*100;
Hi @mayasak,
You may be lucky with your data, but in general I would use the ROUND function (or the INT function in your particular case) to ensure that the resulting numbers are exactly what you would expect:
... then variable=round(variable*100,1e-9);
Thus you avoid surprises like in this log (obtained with SAS 9.4M5 on Windows):
77 data _null_; 78 if 0.14*100~=14 & 0.29*100<29 & 0.55*100>55 then put 'Surprised?'; 79 run; Surprised? NOTE: DATA statement used (Total process time):
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 lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.