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


 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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