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

I assigned labels however, I left your code 99% intact but wrapped inside an absolute layout (could use gridded also) and specified the dimension that you can change.  You did not specify the output format so I picked pdf

 Untitled.png

 

 

data prim_sub_use; set xl.sheet1; 
label 
Alcohol	='^_^_Alcohol^_'
Opiates	='^_^_Opiates^_'
Cocaine	='^_^_Cocaine^_'
Marijuana='^_^_Marijuana/hashish^_'
Methamphetamine_amphetamines='^_Methamphetamine/amphetamines^_'
;
run;
ods escapechar='^';
ods _all_ close;
options nonumber nodate orientation=landscape papersize=letter nocenter
	leftmargin=.5in rightmargin=.5in topmargin=.5in bottommargin=.5in;
ods pdf file="~/img/abuse.pdf" dpi=300 notoc;
ods layout absolute;
ods region x=0in y=0in width=10in;
ods graphics on /noborder height=7.5in width=10in scale=on;
proc sgplot data=prim_sub_use noborder nowall 
		description='Primary substance use at admission, 2007-2017';
	series x=Year y=Alcohol/markers markerattrs=(symbol=CircleFilled 
		color='#0060A9' size=12) lineattrs=(color='#0060A9' thickness=3);
	series x=Year y=Opiates/markers markerattrs=(symbol=TriangleDownFilled size=12 
		color='#ed1c24') lineattrs=(color='#ed1c24' thickness=3 pattern=solid);
	series x=Year y=Cocaine/markers markerattrs=(symbol=SquareFilled 
		color='#ffc222' size=12) lineattrs=(color='#ffc222' thickness=3 
		pattern=solid);
	series x=Year y=Marijuana/markers markerattrs=(symbol=DiamondFilled 
		color='#64c069' size=12) lineattrs=(color='#64c069' thickness=3 
		pattern=solid) ; * legendlabel="Marijuana/hashish";
	series x=Year y=Methamphetamine_amphetamines/markers 
		markerattrs=(symbol=TriangleFilled size=12 color='#00a2e5') 
		lineattrs=(color='#00a2e5' thickness=3 pattern=solid);
	yaxis label='Percent of all admissions aged 12 years and older' VALUES=(0 TO 50 BY 10) offsetmax=0 offsetmin=0;
	xaxis label='Admission Year' VALUES=(2007 TO 2017 BY 1) display=(nolabel 		noticks);
	keylegend/noborder linelength=30;
run;
ods graphics off;
ods layout end;
ods pdf close;
ods _ALL_ CLOSE;

 

 

martyvd
Fluorite | Level 6
Thanks, I think this will work for me.
martyvd
Fluorite | Level 6
It added a light gray border despite containing the noborder option. Is there a different option I need to use to remove it?
martyvd
Fluorite | Level 6

See attached. 

ghosh
Barite | Level 11
perhaps in the ods region line add
style=[borderwidth=1 bordercolor=white];

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 19 replies
  • 4227 views
  • 1 like
  • 6 in conversation