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

Quoting the directory path in below statement, when its supplied as a macro variable,

path in

%let logdir = c:\test;

%let filot = %str(%'dir %")&logdir%%str(%" /a-d /b /s%');

%put &filot;

filename catd pipe &filot ;

filename catd pipe %nrstr(&filot);

'%put' resolves &filot to the exact value in filename statement, but none other statements gets resolved.

D Moovendhan

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

%let logdir = c:\test;

%let command = dir "&logdir" /a-d /b /s ;

%put &command;

filename catd pipe %sysfunc(quote(&command));

View solution in original post

5 REPLIES 5
DBailey
Lapis Lazuli | Level 10

try this:


filename catd pipe "&filot" ;

DMoovendhan
Quartz | Level 8

Thank you Bailey, I have tried this, but it doesn't work...

Tom
Super User Tom
Super User

%let logdir = c:\test;

%let command = dir "&logdir" /a-d /b /s ;

%put &command;

filename catd pipe %sysfunc(quote(&command));

DMoovendhan
Quartz | Level 8

Thank you Tom this was more helpful.. Now I know new function quote.. Smiley Happy

Tom
Super User Tom
Super User

You can also just double the internal quotes yourself.

filename catd pipe "dir ""&logdir"" /a-d /b /s ";

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
  • 5 replies
  • 1857 views
  • 5 likes
  • 3 in conversation