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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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