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 (June 2005, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 19 Jun 2005 07:54:10 -0400
Reply-To:     Nathaniel_Wooding@DOM.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Nat Wooding <Nathaniel_Wooding@DOM.COM>
Subject:      Re: Combining multiple input files into one new output file
Comments: To: Bear <taycon@IINET.NET.AU>
Content-Type: text/plain; charset="US-ASCII"

Bear

Try using a wildcard reference in an infile statement.

Here, I created two text files named test1.txt and test2.txt and stuck them in my C root . I read them with the following and simply routed the output to print.

filename readin 'c:\test*.txt'; data _null_; infile readin; input; file print; put _infile_;

run;

I ran this with windows 8.2 but I have used a similar filename statement under OS/390.

Nat Wooding

|---------+----------------------------> | | Bear | | | <taycon@IINET.NET| | | .AU> | | | Sent by: "SAS(r) | | | Discussion" | | | <SAS-L@LISTSERV.U| | | GA.EDU> | | | | | | | | | 06/19/2005 02:49 | | | AM | | | Please respond to| | | Bear | | | | |---------+----------------------------> >--------------------------------------------------------------------------------------------------------------------------------| | | | To: SAS-L@LISTSERV.UGA.EDU | | cc: | | Subject: Combining multiple input files into one new output file | >--------------------------------------------------------------------------------------------------------------------------------|

I have a situation where I have dynamically allocated an unknown number of external input files, which I would now like to read and write out one after the other to an external output file The files have DDNAMES of SERV1, SERV2 etc up to SERVN. I have tried something like this using the variable _N_ to give me the ddname suffix with little result: DATA NULL; ATTRIB DDNAME FORMAT=$20.; DDNAME = "SERV" || TRIM(LEFT(_N_));

INFILE FILEVAR=DDNAME MISSOVER END=DONE; FILE OUTFILE; DO UNTIL(DONE); INPUT LINE $CHAR200.; PUT _INFILE_; END;

I know this is not the correct use of FILEVAR, just to give you an example of what I have tried. Any ideas?

----------------------------------------- CONFIDENTIALITY NOTICE: This electronic message contains information which may be legally confidential and/or privileged and does not in any case represent a firm ENERGY COMMODITY bid or offer relating thereto which binds the sender without an additional express written confirmation to that effect. The information is intended solely for the individual or entity named above and access by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.


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