Help using Base SAS procedures

appending files in a directory

Reply
N/A
Posts: 0

appending files in a directory

Hi,
Im new to sas and I need to append multiple files in a single directory into one file. Ive seen ways to append one file to another but Im curious what is needed to append multiple files that are in one directory together? Message was edited by: TDS
Super Contributor
Super Contributor
Posts: 3,174

Re: appending files in a directory

When you mention append files, one could infer that you are appending sequential files, not SAS files. You can use the SAS DATA step process combined with a FILENAME statement, in order to treat the entire set of files as one concatenated stream. With the FILENAME statement enclose the list of files in parantheses. And using the DATA step, use the INFILE and FILE statements, combined with an INPUT and PUT _INFILE_; set of statements to process your data. No SAS file is created, only your output file specified in the (output) FILE statement.

Have a look at the SAS "companion" document for your operating environment, with focus on the topics "Using External Files" and also "Concatenating Filenames". Here is a link to one reference for the UNIX environment - there are similar discussions for other environments:

http://support.sas.com/documentation/cdl/en/hostunx/59542/HTML/default/a000386629.htm

Also, you will find the SAS support website http://support.sas.com/ has SAS product documentation and also supplemental technical (SAS staff and user community contributed) papers on this type of topic -- have a look at using the SEARCH facility or use Google (example below) to search the site for relevant material:

concatenate sequential files filename site:sas.com

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 1 reply
  • 96 views
  • 0 likes
  • 2 in conversation