Date: Thu, 25 Jan 2007 16:39:25 -0500
Reply-To: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject: Re: loop through all files in dir for inclusion in macro
Refer to the D...-functions in the SAS docu (DOPEN, DNUM, DREAD, ...) for
reading the files in a data-step and put them into macro variables like
...
do i=1 to number_of;
call symput("no",i);
call symput("n"!!compress(put(i,8.)),name);
end;
...
Then you can use a macro loop to get them all in.
On Thu, 25 Jan 2007 16:22:44 -0500, Fehd, Ronald J. (CDC/CCHIS/NCPHI)
<rjf2@CDC.GOV> wrote:
>> From: StephenTGallagher
>> I have a directory with ten (abitrary number...could be
>> hundreds) of files, whose naming convention is not
>> consistent, but, more or less, extension is .txt or .csv.
>
>> I have a macro to, for example, import all of these files.
>> Currently I am hardcoding the filenames. I am sure this is a
>> tremendous waste of time.
>
>I provide a non-trivial sql solution to this problem in this paper:
>
>How to Use Proc SQL select into for List Processing
>http://www.pnwsug.com/Conference_2006/Procedings/PNWSUGotherfiles/PN12Fe
>hdSQL.pdf
>
>send e-mail with
>subject: request HOW-SQL ProcSQL-select-into-list-from-filenames.sas
>
>Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov
|