BookmarkSubscribeRSS Feed
KrisNori
Obsidian | Level 7

I have the below shown parts data that shows the increase/decrease in usage.

 

Part usage change
ABC5601 10%
ABC7551 -5%
ABC8206 15%

 

I want to create a frequency distribution as below.

 

distribution Part count
1% to 5% 5
6% to 10% 15
(5%) to (1%) 10

 

Is there any sas proc that takes the interval value as input and create a freq distribution table ?

2 REPLIES 2
ballardw
Super User

@KrisNori wrote:

I have the below shown parts data that shows the increase/decrease in usage.

 

Part usage change
ABC5601 10%
ABC7551 -5%
ABC8206 15%

 

I want to create a frequency distribution as below.

 

distribution Part count
1% to 5% 5
6% to 10% 15
(5%) to (1%) 10

 

Is there any sas proc that takes the interval value as input and create a freq distribution table ?


You may have to provide a little more data such as input that would allow use to create the example output from.

If your "usage change" is a numeric variable this might be possible with proc freq and a custom format to create groups of values based on those values. Some concerns would arise on where the endpoints of your "distribution" column appears as I would expect that unless the values of that "usage change" have been rounded that you might have values like 5.4% (or 0.54) . So where the endpoint values for given display "range" should be would need some clarification.

Reeza
Super User

@KrisNori wrote:

 

Is there any sas proc that takes the interval value as input and create a freq distribution table ?


PROC FREQ and apply a format on the value.

 

*create the format;
proc format;
value age_group
low - 13 = 'Pre-Teen'
13 - 15 = 'Teen'
16 - high = 'Adult';
run;

*Summarize data
proc freq data=sashelp.class;
table age / out=want;
format age age_group.;
run;

The want data set has the summarized data in a data set. Do note that the variable AGE has the underlying values still present but a format applied which can be confusing at first if you're just starting out with formats.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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