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?
TIA
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';
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';
run;
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.
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.
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.