Help using Base SAS procedures

Using gplot or pareto?

Accepted Solution Solved
Reply
Contributor
Posts: 28
Accepted Solution

Using gplot or pareto?

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


Accepted Solutions
Solution
‎11-29-2016 08:47 PM
Super User
Posts: 10,046

Re: Using gplot or pareto?

Posted in reply to sas_newbie3
output cumulative percent into table freq .

View solution in original post


All Replies
Super User
Posts: 19,870

Re: Using gplot or pareto?

Posted in reply to sas_newbie3

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?

Contributor
Posts: 28

Re: Using gplot or pareto?

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.

 

Super User
Posts: 10,046

Re: Using gplot or pareto?

Posted in reply to sas_newbie3

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;
Contributor
Posts: 28

Re: Using gplot or pareto?

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

The sashelp.class is just a demo example? 

Super User
Posts: 19,870

Re: Using gplot or pareto?

Posted in reply to sas_newbie3

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.  

Contributor
Posts: 28

Re: Using gplot or pareto?

table age/out=freq outcum;

For this line code. What is outcum?

It is not used in the later code.

Solution
‎11-29-2016 08:47 PM
Super User
Posts: 10,046

Re: Using gplot or pareto?

Posted in reply to sas_newbie3
output cumulative percent into table freq .

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 586 views
  • 1 like
  • 3 in conversation