The SAS Output Delivery System and reporting techniques

sgplot with Multiple variables on vbar

Reply
Contributor
Posts: 21

sgplot with Multiple variables on vbar

SAS v 9.3

I am trying to generate a simple sgplot with percentages.  I want to be able to add multiple variables on the vbar statement but that is not an option. I have I am also having trouble creating a data set from my proc freq that includes ALL of my variables. 

data work.ins15;

set ins.ins15;

run;

 

proc freq data=work.ins15;

tables cig ecig chew / plots=FreqPlot(scale=Percent) out=Freq1Out; /* save Percent variable */

weight _cpwt;

where cig=1 and ecig=1 and chew=1;

run;

data Freq1Out;

set Freq1Out ;

Percent = Percent / 100; /* adjust range to [0, 1] */

format Percent PERCENT5.;

run;

title "";

proc sgplot data=Freq1Out noborder;

vbar cig / response=Percent datalabel

fillattrs=(color=blue); /* axis shows percentages instead of counts */

xaxis display=(nolabel);

yaxis display=(nolabel) ;

run;

Ask a Question
Discussion stats
  • 0 replies
  • 356 views
  • 0 likes
  • 1 in conversation