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.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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