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 (October 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 27 Oct 2009 16:32:38 -0400
Reply-To:   Carol Thurman <erbcjt@LANGATE.GSU.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Carol Thurman <erbcjt@LANGATE.GSU.EDU>
Subject:   Re: Macro Help
Comments:   To: snoopy369@GMAIL.COM
Content-Type:   text/plain; charset=US-ASCII

Thanks, Joe!

Carol

>>> Joe Matise <snoopy369@GMAIL.COM> 10/27/09 4:29 PM >>> The wildcard means (any characters), so as long as at some point it's (generic characters) you're fine.

*P.yyy would include AP.YYY as well as 201.YYY .

I'm not sure what other wildcard options there are, perhaps DOS wildcard options [or, more specifically, OS-dependent]? I don't actually see it documented anywhere, which I find odd.

Also, if you look at the INFILE documentation for 9.1.3 (at least), one of the examples (Example 5) shows you how to read multiple files in using FILEVAR option - you put your different filenames in the datalines, and use those filenames to control your input file. Can be easier to do than running a macro, I suspect, even if it does require listing all of the files out.

-Joe

On Tue, Oct 27, 2009 at 3:16 PM, Carol Thurman <erbcjt@langate.gsu.edu>wrote:

> Thanks, Joe. I didn't know about the wildcard option. I will use it. Can > I specify which files with a yyy extension I need? For example, can the > wildcard be: *P.yyy ? Or would I have to move all of the files that I want > in a different folder? I'm asking because I have files that are AP.YYY and I > wouldn't want the program to call them. > > >>> Joe Matise <snoopy369@GMAIL.COM> 10/27/09 4:02 PM >>> > If you want to merge them together, why do you do an export every single > macro call? > > First off, though, you can use file commands to allow you to read multiple > files in (if you have a simple wildcard expression that identifies all of > the files you want), in one datastep: > > data test; > infile "j:\PAL Raw Data\*.yyy" missover; > input @41 ID 3. > @46 code 1. > @52 (q1-q78) ($1.); > run; > > Second, you either need to use PROC APPEND [and skip 'data combo'], or in > your data combo, you should do: > data combo; > set combo test; > run; > > otherwise you aren't appending to combo, you're overwriting it. > > But in general, try to use the wildcard option and skip the macro, if you > can. > > What's the %end doing there, also? That should cause an error. > > -Joe > On Tue, Oct 27, 2009 at 2:39 PM, Carol Thurman <erbcjt@langate.gsu.edu > >wrote: > > > I need to call in some txt files and then I want to merge (stack) them > > together as one file. I'm trying to figure out a quick way to do this > using > > macros. I'm stuck and need help. My log looks good but the csv file is > not > > being created. I'm thinking I need a proc append statement. Can someone > > help? > > > > Here's my syntax: > > > > >>>%macro PAL (P=); > > > > >>>options mprint; > > > > >>>filename io 'J:\PAL Raw Data\'; > > > > >>>data PALS; > > >>>infile io (&P.yyy) missover; > > >>>input @41 ID 3. @46 code 1. @52 (q1-q78) ($1.); > > >>>run; > > > > >>>>data combo; set &P; > > > > >>>>RUN; > > > > > > >>>>>PROC EXPORT DATA= WORK.combo > > >>>>OUTFILE= "J:\PAL 2009\HS ReliabilityMacro.csv" > > >>>>DBMS=CSV REPLACE; > > > > >>>RUN; > > > > /*proc append base=ALLPALS; data=combo; > > /*run;*/ > > %end; > > %mend PAL; > > %macro PAL (P=201); > > %macro PAL (P=202); > > %macro PAL (P=203); > > > >


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