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 15:00:18 -0500
Reply-To:   Joe Matise <snoopy369@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Joe Matise <snoopy369@GMAIL.COM>
Subject:   Re: Macro Help
Comments:   To: Carol Thurman <erbcjt@langate.gsu.edu>
In-Reply-To:   <4AE7142A020000E20002FE59@mailsrv4.gsu.edu>
Content-Type:   text/plain; charset=ISO-8859-1

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