Hi,
I'm trying to format a field. The field is called "Score" and it is a 3 digit number (and it is specified as a number with a length of 8). However, the code is not grouping them as desired. It appears to be bouncing back the same score for each observation. Can someone tell me what I am doing wrong?
proc format;
value $ScoreFormat
1-599 ='<600'
600-640 ='600-640'
641-680 ='641-680'
681-720 ='681-720'
721-760 ='721-760'
761-999 ='761+ '
. ='Missing';
run;
data temp2;
set temp1;
Score_Band = put( Score ,$ScoreFormat.);
run;
Example fields:
Acct Score
1 550
2 665
3 775
Output:
Acct Score_Band
1 550
2 665
3 775
Desired Output:
Acct Score_Band
1 <600
2 641-680
3 761+
Thank you in advance.
Try creating a numeric format - note I've just removed the dollar sign on the front. If you are applying a format to a numeric variable the format must also be numeric:
proc format;
value ScoreFormat
1-599 ='<600'
600-640 ='600-640'
641-680 ='641-680'
681-720 ='681-720'
721-760 ='721-760'
761-999 ='761+ '
. ='Missing';
run;
Try creating a numeric format - note I've just removed the dollar sign on the front. If you are applying a format to a numeric variable the format must also be numeric:
proc format;
value ScoreFormat
1-599 ='<600'
600-640 ='600-640'
641-680 ='641-680'
681-720 ='681-720'
721-760 ='721-760'
761-999 ='761+ '
. ='Missing';
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.