LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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


Back to: Top of message | Previous page | Main SAS-L page