Date: Wed, 27 Jan 2010 17:49:56 +0100
Reply-To: Daniel Fernández <fdezdan@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Daniel Fernández <fdezdan@GMAIL.COM>
Subject: Re: SAS code help
In-Reply-To: <8c7ace4a-a909-4ce4-99c0-158633df1ca0@k41g2000yqm.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
hi,
try to write the following option before the data step that calls the infile :
Options validvarname=any;
data enc(drop=trailer records totamtpaid)
trailer(keep=trailer records totamtpaid);
infile mydir truncover;
...
..
Daniel Fernandez.
Barcelona
2010/1/27 Ruby <windofoct@gmail.com>:
> hi SAS experts,
>
> I need to read some raw data files into sas. However, the files name
> has an invalid "-' sign in it. So, I tried to modify the old program
> by adding a new variable "sourcefile1" but with no success. Can anyone
> here help to explain why my codes did not work? I added a "/***/" mark
> after my codes.
>
> Also, do you have a good way to read the files in without changing the
> file names manually?
>
> Thanks very much!!!
>
>
> filename mydir pipe " dir /B /N Q:\rawdata\*.txt";
>
> data enc(drop=trailer records totamtpaid)
> trailer(keep=trailer records totamtpaid);
> infile mydir truncover;
> input sourcefile $50;
> length sourcefile1 $50; /***/
> sourcefile1=translate(sourcefile,'_', '-'); /***/
> fil2read="Q:\rawdata\"||sourcefile1; /***/
> infile dummy filevar=fil2read end=done lrecl=239 truncover ;
>
> do while (not done);
> input ....
>
|