data march;
input id name$ score;
datalines;
1 aaa 55
2 bbb 77
3 ccc 22
4 ddd p
5 eee 4
6 ff k
;
run;
/* update values above datasets */
data march;
modify march;
if score=p then score=98;
run;
hi i want to update value of score where score= p then i want change 98 but above update where character value i want only required value to change
Your first DATA step needs fixing. Do that first.
And your second data step will only work if there is a variable named p in your dataset.
This is obviously a made up problem, but changing an invalid value, like the letter P, to a valid value, is a very poor practice. Better you should leave the P as missing, SAS does the correct things when it encounters a missing value. SAS will probably not do the correct things when it finds a 98.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.