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

Hello,

 

 

How do I mask special characters when generating a pdf file in Unix directory. My file name comes from a macro parameter. 

 

data test;
file_name="Test/File";
run;
/* Also files can have unclosed single quote or & or % */

proc sql;
select file_name into: file
from test ;
quit;

ods pdf file="/usr/&file..pdf";
proc print data=sashelp.class;
run;
ods pdf close;

%nrstr() works fine, but when I have '/' it doesn't mask and throws error Physical file doesn't exist. ('/' is treating as another directory in Unix)

 

 

 

Thanks,
Suryakiran
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

I don't think this is a SAS issue.  You cannot make a file with a slash in its name.

What name do you want to use instead?

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

I don't think this is a SAS issue.  You cannot make a file with a slash in its name.

What name do you want to use instead?

SuryaKiran
Meteorite | Level 14

Disregard this, I totally forgot that file names with '/' can't be created. sometimes I am dumb Man Tongue

Thanks,
Suryakiran

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
  • 1355 views
  • 0 likes
  • 2 in conversation