Date: Wed, 28 Nov 2007 16:40:52 -0600
Reply-To: "data _null_," <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_," <datanull@GMAIL.COM>
Subject: Re: embed blanks in macro var used in pipe
Content-Type: text/plain; charset=ISO-8859-1
Do you just need to double up the double quotes?
265 %let mydir=c:\example_data\ ;
266 filename dir_list pipe "dir ""&mydir..*.dat"" /b";
267 filename dir_list list;
NOTE: Fileref= DIR_LIST
Physical Name= dir "c:\example_data\.*.dat" /b
On Nov 28, 2007 4:32 PM, F. J. Kelley <email@example.com> wrote:
> I know I solved this some time ago, but have forgotten.
> simple case:
> %let mydir=c:\example_data\ ;
> filename dir_list pipe "dir &mydir..*.dat /b";
> data test;
> infile dir_list ;
> and you get all the .dat files in the directory (yes, this is part of a larger pgm)
> However, suppose the path includes embedded blanks:
> at a win cmd prompt you can type
> dir "C:\Documents and Settings"
> but you cannot type
> dir 'C:\Documents and Settings'
> so the first example cannot be used because a macro var will not resolve inside ''. And it gets better: I may need a macro variable inside the path as well.
> I came up with a solution a few years ago and know I have seen another, probably on SAS-L, so thought I'd ask. (plus it has been a looong day, and I don't really think a pkg of 6 oreos counts as a great lunch, but heck, more than in grad schl).