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.

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
  • 333 views
  • 2 likes
  • 3 in conversation