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;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.