DATA Step, Macro, Functions and more

How read a directory and append the files in it to one file

Reply
N/A
Posts: 0

How read a directory and append the files in it to one file

Hi All,
After one days of SAS tutorails
I have been assigned a task to read all the files in a driectory and append them to one. Can i get a short SAS code on this. I could manage to read a directory but after that I am clueless
Thanks
SAS Super FREQ
Posts: 8,743

Re: How read a directory and append the files in it to one file

Hi:
It really depends on whether your directory contains SAS datasets that you want to append into 1 bigger SAS dataset or whether your directory contains a set of disparate files (like .TXT or .CSV files) that you want to append together.

The code would be different depending on what/how you want to do the appending. For SAS datasets, you might want to look at the syntax for PROC APPEND (for a procedure method to append SAS datasets) or the SET statement within a DATA step program (for a program language method to append). In addition, you could use PROC SQL for appending SAS datasets together.

If you look in the documentation that's on-line and/or search for previous forum postings, I believe you'll find some code examples to help you.

cynthia
Ask a Question
Discussion stats
  • 1 reply
  • 100 views
  • 0 likes
  • 2 in conversation