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

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

1 ACCEPTED SOLUTION

Accepted Solutions
wernie
Quartz | Level 8

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

2 REPLIES 2
wernie
Quartz | Level 8

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.

PaigeMiller
Diamond | Level 26

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

--
Paige Miller

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 686 views
  • 1 like
  • 2 in conversation