BookmarkSubscribeRSS Feed
CurryThree6
Calcite | Level 5

hello, I'm fairly new at SAS EG. I have a SAS date set with columns Product Name and Units Ordered with 10 Product Names, and Units Ordered range from 0-500, and are in 10s (0, 10, 20, etc). I'm confused on how I can create a report that shows both how many times orders were placed with 0 units for each of the different products, and what percentages of the orders for these different products had 0 units ordered. Any help? I'm thinking I'm supposed to use either a Summary Table or Summary Statistics, but just can't quite get it. 

2 REPLIES 2
TomKari
Onyx | Level 15

Hi, welcome to the exciting (and sometimes irritating!) world of SAS

 

I'm having trouble visualizing exactly what your results should look like. If you could post a small amount of sample data, and a sample of what result you expect from it, that would help. There are guidelines for new posters about how to demonstrate the problem.

 

Tom

Reeza
Super User

Yes, use a Summary Task to get the counts first. 

Make sure to create an output data set with this task. 

Then Filter the output data set to only include the 0 records. 

 

Via code it would look something like this, assuming you were trying to find the # of 12 year olds by each sex in a data set. 

Input data set name is sashelp.class and the variable names are age and sex. 

The summary data is in the SummaryTable data set and the final filtered result is in the Filtered data set.

 

proc freq data=sashelp.class;
table sex*age / out=summaryTable outpct;
run;

data filtered;
set summaryTable;
where age=12;
drop percent pct_col;
rename pct_row = PercentAge12;
run;

proc print data=filtered;
run;

 

 

 


@CurryThree6 wrote:

hello, I'm fairly new at SAS EG. I have a SAS date set with columns Product Name and Units Ordered with 10 Product Names, and Units Ordered range from 0-500, and are in 10s (0, 10, 20, etc). I'm confused on how I can create a report that shows both how many times orders were placed with 0 units for each of the different products, and what percentages of the orders for these different products had 0 units ordered. Any help? I'm thinking I'm supposed to use either a Summary Table or Summary Statistics, but just can't quite get it. 


 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 518 views
  • 0 likes
  • 3 in conversation