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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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