DATA Step, Macro, Functions and more

How to import several .csv files at once and then Append all of them

Reply
Contributor
Posts: 48

How to import several .csv files at once and then Append all of them

Spoiler
 

I have several csv file in a folder, I want to import all of them into sas and then append all of them in one table.

 

(All csv files columns are same)

Super User
Posts: 7,830

Re: How to import several .csv files at once and then Append all of them

You can use wildcards in the infile statement:

data want;
infile "path_to_files/*.csv" /* further options */;
input ........;
run;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Posts: 19,822

Re: How to import several .csv files at once and then Append all of them

Get it working for one dataset then you can switch if to an automated version.  See one method detailed here. 

 

https://communities.sas.com/t5/SAS-Communities-Library/How-do-I-write-a-macro-to-import-multiple-tex...

Ask a Question
Discussion stats
  • 2 replies
  • 108 views
  • 0 likes
  • 3 in conversation