I have a list of 20-30 factors which I would like to create 4 graphs each for. Ideally I would like them in an excel file, each on a separate sheet (four graphs per sheet) but I know that's next too impossible. Exporting to powerpoint and pdf are sufficient alternatives. What I like about Excel is that you can separate each factor into its own workbook. I have started the process off using robslink.com as a reference.
My code is below (which I took from http://www.robslink.com/SAS/democd7/clin1_info.htm)
Couple of points:
My main challenges are:
data my_data;
INFILE DATALINES DLM=',';
format factor level $16.;
input factor $ level $ exposure lossratio ;
datalines ;
occupation,professional,500,.44
occupation,student,1000,.55
occupation,retired,2000,.75
;
run;
data my_data; set my_data;
length htmlvar $500;
htmlvar=
'title='||quote(
'Level: '|| trim(left(level)) ||'0D'x||
'Vehicle Exposure Years: '|| trim(left(v01_veh_exp_years))||
'Loss Ratio: '|| trim(left(all_LR)))||
' href="clin1_info.htm"';
run;
goptions device=png;
goptions xpixels=750 ypixels=500;
goptions noborder;
ODS LISTING CLOSE;
ODS HTML path=odsout body="&name..htm"
(title="SAS/Graph gbarline Line & Column Chart") style=sasweb;
goptions gunit=pct htitle=6 ftitle="albany amt/bold" htext=4.25 ftext="albany amt/bold";
title1 ls=1.5 "&name. - LR";
/*title2 "Classic Combination Chart";*/
pattern1 v=solid color=cx993366;
symbol1 interpol=join width=3 value=dot height=4 color=navy;
axis1 label=(a=90 'Exposure Years') offset=(0,2) order=(0 to 30000 by 5000) major=(h=-1) minor=none;
axis2 label=(a=90 'Loss Ratio') offset=(0,2) order=(0 to 2 by .5) major=(h=-1) minor=none;
axis3 label = none value=(angle=90) offset=(13,13) ;
device=pdfc
ftext="swissb";
ods pdf file="H:\Commercial\Fleet\Presentations\four in one.pdf" startpage=never;
ods proclabel "Four graphs on one page" ;
goptions hsize=5.20 in vsize=3.75 in;
title1;
proc gbarline data=my_data2;
goptions horigin=0in vorigin=3.99 in;
bar level / discrete
type=sum sumvar=v01_veh_exp_years
axis=axis1 maxis=axis3
space=5 width=6
html=htmlvar
des='' name="&name" ;
plot /
type=sum sumvar=all_LR
axis=axis2
html=htmlvar;
run;
quit;
proc gbarline data=my_data2;
goptions horigin=5.25;
bar level / discrete
type=sum sumvar=v01_veh_exp_years
axis=axis1 maxis=axis3
space=5 width=6
html=htmlvar
des='' name="&name" ;
plot /
type=sum sumvar=all_LR
axis=axis2
html=htmlvar;
run;
quit;
proc gbarline data=my_data2;
goptions hsize= 5.20in vsize= 3.75in device=pdfc ftext="swissb"
bar level / discrete
type=sum sumvar=v01_veh_exp_years
axis=axis1 maxis=axis3
space=5 width=6
html=htmlvar
des='' name="&name" ;
plot /
type=sum sumvar=all_LR
axis=axis2
html=htmlvar;
run;
quit;
proc gbarline data=my_data2;
goptions horigin=5.25 in;
bar level / discrete
type=sum sumvar=v01_veh_exp_years
axis=axis1 maxis=axis3
space=5 width=6
html=htmlvar
des='' name="&name" ;
plot /
type=sum sumvar=all_LR
axis=axis2
html=htmlvar;
run;
quit;
ods pdf close;
You need to post this under the graphics forum:
http://support.sas.com/resources/papers/proceedings12/285-2012.pdf
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.
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.