Hi, in one of the numeric column of my dataset, I have 3 digits and 4 digits number.
I want to remove the last digit if the number have 4 digit, for example:
No Score
1 789
2 673
3 6470
4 783
5 7280
6 785
I want the 6470 to become 647 and 7280 to become 728, how should I do that with SAS programming?
This should do it:
if score >= 1000 then score = int(score/10);
Or take a quick detour to character:
data want;
set have;
score = input(substr(put(score,4.-l),1,3),3.);
run;
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.