I'm slowly learning macros and seem to have some issues along the way that I don't quite know how to resolve yet. I have different graphs that I need to create and want to save so each PDF is named with the state abbreviation followed by '_Origpop_RSEGraph.pdf'. I have an example below with the first state; however, when I run this, my PDF gets saved as &stateabb._Origpop_RSEGraph.pdf. I want it to be saved as 'FL_Origpop_RSEGraph.pdf'. (FYI - I have it saved to a network drive, so I just put desktop in front of the path.) Thanks!
%macro RSE_origpop(stateabb, state);
options orientation=landscape nodate nonumber;
ods pdf file = 'desktop\&stateabb._Origpop_RSEGraph.pdf' dpi=300;
ods graphics on / antialias=on antialiasmax=9500 width=2500 height=1800;
proc sgplot data=&stateabb.outcome.&stateabb._all_stats;
format Threshold Threshold.;
scatter x=cases y=rse_rate;
xaxis label='Cases';
yaxis label='Relative standard error';
title1 'RSE as a function of the number of cases';
title2 '&state';
refline 30 / axis=y lineattrs=(pattern=shortdash color=red);
where Threshold=0;
run;
title1;
title2;
ods pdf close;
%mend RSE_origpop;
%RSE_origpop(FL, Florida);
Never mind - got it sorted! I used double quotes around the filename instead of single quotes. I'll leave this here in case it might help someone else.
Never mind - got it sorted! I used double quotes around the filename instead of single quotes. I'll leave this here in case it might help someone else.
In ODS PDF, use double-quotes instead of single quotes.
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: