DATA Step, Macro, Functions and more

Issues with macro use in naming PDF

Accepted Solution Solved
Reply
Contributor
Posts: 34
Accepted Solution

Issues with macro use in naming PDF

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);


Accepted Solutions
Solution
‎07-12-2017 01:02 PM
Contributor
Posts: 34

Re: Issues with macro use in naming PDF

[ Edited ]

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.

View solution in original post


All Replies
Solution
‎07-12-2017 01:02 PM
Contributor
Posts: 34

Re: Issues with macro use in naming PDF

[ Edited ]

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.

Trusted Advisor
Posts: 1,615

Re: Issues with macro use in naming PDF

In ODS PDF, use double-quotes instead of single quotes.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 85 views
  • 1 like
  • 2 in conversation