BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sas_newbie3
Obsidian | Level 7

I want to plot the following graph by a given dataset. I think may be using PROC PARETO. But I am not exactly sure.

 

Thanks for code hint.

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
output cumulative percent into table freq .

View solution in original post

7 REPLIES 7
Reeza
Super User

You can use SGPLOT or Pareto, it's a matter of choice, assuming you have the SAS/QC and PROC PARETO available. 

 

What exactly is your question though?

sas_newbie3
Obsidian | Level 7

OI don't have Pareto installed, I just found the fact. So I have to use SGPLOT.

 

The goal is 

  1. The bar chart portion is to plot the individual percentages in each group.
  2. The line chart portion is used to plot the cumulative percentages in each group.

 

Ksharp
Super User

You really should post it at ODS Graphic forum.

 

proc freq data=sashelp.class noprint;
table age/out=freq outcum;
run;
data have;
 set freq;
 p=percent/100;
 cum_p=cum_pct/100;
format p cum_p percent7.2;

proc sgplot data=have;
vbar age/response=p nostatlabel fillattrs=graphdata2 legendlabel='percent';
vline age/response=cum_p markers datalabel legendlabel='cum percent';
yaxis label=' ';
keylegend  /across=1 position=right location=inside;
run;
sas_newbie3
Obsidian | Level 7

So I have to calculate freq and cumulative percentage first on the given dataset?

The sashelp.class is just a demo example? 

Reeza
Super User

You can usually use the procs to do some summaries, but since you're needing two different statistics it's easier if you do it first yourself. 

 

So yes, summarize the data using proc freq. SASHELP.CLASS is one of several demo dataset that almost all SAS installations will have. This allows others to run the same code and generate results.  

sas_newbie3
Obsidian | Level 7
table age/out=freq outcum;

For this line code. What is outcum?

It is not used in the later code.

Ksharp
Super User
output cumulative percent into table freq .

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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