BookmarkSubscribeRSS Feed
Calcite | Level 5

I have a dataset with multiple variables. I want to show a certain value like 'less than 100k' for values less than 100k on a frequency table.

I am trying to use the following code but it is not working. Could it be because they are numerical variables and I want to make them show character values?



proc format;
value $Inv inventory<100000 ='Under $100k'
100000<inventory<150000 ='$100k-$150k' inventory>150000 = 'More than $150k';
value $Sale sales<100000 ='Under $100k'
100000<sales<150000 ='$100k-$150k' sales>150000 = 'More than $150k';
Diamond | Level 26
proc format;
    value dollarf inv 0<100000 ='Under $100k'
         100000-<150000 ='$100k-$150k' 150000-high = 'More than $150k';
    value sales 0-100000 ='Under $100k'
         100000-<150000 ='$100k-$150k' 150000-high = 'More than $150k';


In PROC FORMAT, you specify ranges differently than you would in an IF statement. You specify the low value of the range, a dash and then the high value of the range.


Could it be because they are numerical variables and I want to make them show character values?


Not a problem, that's one of the huge benefits of PROC FORMAT is that numerical value ranges can be represented as a text string.

Paige Miller
Super User

One of the other strengths of the Format for display is when multiple values are to be displayed with the exact same range descriptions only ONE format is needed.





Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

From SAS Users blog
Want more? Visit our blog for more articles like these.
5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 3 in conversation