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;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.