BookmarkSubscribeRSS Feed
rojomauri
Calcite | Level 5

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

1 REPLY 1
Reeza
Super User

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


 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 910 views
  • 0 likes
  • 2 in conversation