Dear SAS-users,
I would like to change the style of the lines for the section up until 2011. I would like to have dotted line instead of the filled line. HOw would I do this?
data graph_avg2;
input year change_cc change_ls;
datalines;
2010 100 100
2011 100 100
2012 104.050 100.98
2013 112.217 108.458
;
run;
proc sgplot data=graph_Avg2;
title "ALL HOSPITALS- W/O MIDDLE BUCKET";
vline year / response=change_cc lineattrs=(color=gold thickness=4) name='cc' legendlabel='Assuming 100% CC';
vline year / response=change_ls lineattrs=(color=red thickness=4) name='ls' legendlabel='Assuming 100% LS';
yaxis discreteorder=data display=(noline nolabel noticks) min=80 values=(0 to 5000);
xaxis display=(noline noticks) grid label='year' values=(2010 to 2013 by 1) offsetmin=0;
run;
You can do something like this
data graph_avg2;
input year change_cc change_ls;
date=mdy(12, 31, year);
format date date9.;
datalines;
2010 100 100
2011 100 100
2012 104.050 100.98
2013 112.217 108.458
;
run;
proc expand data=graph_avg2 out=graph_avg2_expand from=year to=day;
convert change_cc change_ls / method=join;
id date;
run;
data graph_avg2_expand;
set graph_avg2_expand;
group=ifc(date>"31dec2010"d, "After", "Before");
run;
ods graphics on / attrpriority=none;
title "ALL HOSPITALS- W/O MIDDLE BUCKET";
proc sgplot data=graph_avg2_expand noautolegend;
styleattrs datalinepatterns=(dash solid);
series x=date y=change_cc / group=group lineattrs=(color=gold thickness=4) name='cc' legendlabel='Assuming 100% CC';
series x=date y=change_ls / group=group lineattrs=(color=red thickness=4) name='ls' legendlabel='Assuming 100% LS';
yaxis discreteorder=data display=(noline nolabel noticks) min=80;
xaxis display=(noline noticks) grid label='year' offsetmin=0;
run;
Have a look at this blog:
https://blogs.sas.com/content/graphicallyspeaking/
It has examples of every type of graph with code etc. It is the goto for anything graph like.
Also a quick Google found this in the SAS help:
http://support.sas.com/kb/35/864.html
It is pattern you want.
You can do something like this
data graph_avg2;
input year change_cc change_ls;
date=mdy(12, 31, year);
format date date9.;
datalines;
2010 100 100
2011 100 100
2012 104.050 100.98
2013 112.217 108.458
;
run;
proc expand data=graph_avg2 out=graph_avg2_expand from=year to=day;
convert change_cc change_ls / method=join;
id date;
run;
data graph_avg2_expand;
set graph_avg2_expand;
group=ifc(date>"31dec2010"d, "After", "Before");
run;
ods graphics on / attrpriority=none;
title "ALL HOSPITALS- W/O MIDDLE BUCKET";
proc sgplot data=graph_avg2_expand noautolegend;
styleattrs datalinepatterns=(dash solid);
series x=date y=change_cc / group=group lineattrs=(color=gold thickness=4) name='cc' legendlabel='Assuming 100% CC';
series x=date y=change_ls / group=group lineattrs=(color=red thickness=4) name='ls' legendlabel='Assuming 100% LS';
yaxis discreteorder=data display=(noline nolabel noticks) min=80;
xaxis display=(noline noticks) grid label='year' offsetmin=0;
run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: