BookmarkSubscribeRSS Feed
SASPhile
Quartz | Level 8


I'm looking to format fico score difference between the months and categorize. I'm using the proc format to do it. but the issue I'm facing is the negative or decrease in fico between current and previous months ,the proc format doesnt seem to take my negative scores properly. the first category -10 - <0 is not taking properly. I woiuld like to define other negative scores as well.

proc format;

  value diff

      -10 - <0      = '-10'

     0 -  <15     = '0-14'

    15 -  <30     = '15-29'

    30 -  <50     = '30-49'

    50 -  <100    = '50-99'

    100 -  High    = '100+';

run;

data t;
input score;
cards;
100
-20
-30
-10
10
20
0
;
run;

data y;
set t;
format score diff.;
run;

2 REPLIES 2
SASKiwi
PROC Star

What do you expect to happen with the -10 - < 0 range? The only test value matching this range is -10 and when I run your code it displays as -10 which is exactly what you specified: -10 - <0      = '-10'

ballardw
Super User

Default behavior for custom formats: If you have a data value that is not in the range given it will display with a BEST value.

So -20 and -30, since there is no specific instruction for them will display as -20 and -30 exactly as expected.

If you want ALL negative values to show in the same range then use

LOW - < 0

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 708 views
  • 2 likes
  • 3 in conversation