Date: Wed, 28 Nov 2007 10:12:16 -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: Using macro variables in the filename statement (with pipe
access method)
In-Reply-To: <C3C1925D945BF844911C8EEA752666AE126AE0EF@psbexmb2.psb.bls.gov>
Content-Type: text/plain; charset=ISO-8859-1
The problem is not with SAS exactly but your directory. It contains a
space in the name... so you need to double quote the directory name
also.
%let year = 00;
filename cpsdir pipe "dir /B /N ""C:\WINNT\Profiles\dale_j\My
Documents\CPS Data\CPS&year\""";
151 %let year = 00;
152 filename cpsdir pipe "dir /B /N ""C:\WINNT\Profiles\dale_j\My
153 Documents\CPS Data\CPS&year\""";
154 filename cpsdir list;
NOTE: Fileref= CPSDIR
Physical Name= dir /B /N
"C:\WINNT\Profiles\dale_j\MyDocuments\CPS Data\CPS00\"
On Nov 28, 2007 10:02 AM, Dale, Jason - BLS <Dale.Jason@bls.gov> wrote:
> Hi,
>
> I am trying to use a macro variable in my filename statement, but SAS
> refuses to recognize it. what am I doing wrong?
>
>
> %let year = 00;
> filename cpsdir pipe "dir /B /N C:\WINNT\Profiles\dale_j\My
> Documents\CPS Data\CPS&year\";
> Data cps;
> length file_name $ 100;
> length ext $ 2;
> infile cpsdir truncover;
> input file_name $200.;
> ext = substr(trim(left(file_name)),5,2);
> file_name = "C:\WINNT\Profiles\dale_j\My Documents\CPS Data\CPS&year\"
> || trim(left(file_name));
> call symput('extension',ext);
> run;
>
>
> As always, your help and assistance is greatly appreciated.
>
> Jason
>
|