Help using Base SAS procedures

Import CSV to sas data

Reply
New User
Posts: 1

Import CSV to sas data

Hi,

I need to import many CSV files into a SAS data.

All the CSV has the same structure but different names:

 

/test/Inventario201701cons.csv

/test//Inventario201702cons.csv

/test/Inventario201703cons.csv

.......

So, I need to import the files depending the date (month) when I started my study. If my started month was 201701 (JAN-17), I will need to take +6 CSV files from JAN-17, so I need 201701-201702-.......-201706, but If I started on 201703, I will need 201703-....-201708 and so on

 

Could you please help!

 

Thanks

Super User
Posts: 23,776

Re: Import CSV to sas data

Posted in reply to rojomauri

If they're all in one folder, you can use a wildcard approach instead. 

And you can read all at once, assuming you want all of the tables stacked together. 

 

Here's a write up on how to do that. 

 

If you need further help, you should include your code, the log and description of what issues you're having. 

 

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

 

If you need instructions on how to import a CSV file see here:

http://video.sas.com/detail/videos/sas-analytics-u/video/4573016758001/creating-a-sas-table-from-a-c...

 


rojomauri wrote:

Hi,

I need to import many CSV files into a SAS data.

All the CSV has the same structure but different names:

 

/test/Inventario201701cons.csv

/test//Inventario201702cons.csv

/test/Inventario201703cons.csv

.......

So, I need to import the files depending the date (month) when I started my study. If my started month was 201701 (JAN-17), I will need to take +6 CSV files from JAN-17, so I need 201701-201702-.......-201706, but If I started on 201703, I will need 201703-....-201708 and so on

 

Could you please help!

 

Thanks


 

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