BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GKati
Pyrite | Level 9

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;
1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

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;

View solution in original post

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

PeterClemmensen
Tourmaline | Level 20

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;

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 14697 views
  • 0 likes
  • 3 in conversation