BookmarkSubscribeRSS Feed
jayasubbareddy
Calcite | Level 5

i have 1000 csv files i need to import all files at a time by using both using macro statements

5 REPLIES 5
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

before jumping to macro aspect do you have working code to read a single csv file?

you have to do the basic concept of getting the data into a SAS table before macro functions can be applied.

You have not given needed information in order to assist you.

 

jayasubbareddy
Calcite | Level 5

i have already knowledge on Base sas i am expected sas macro 

Kurt_Bremser
Super User

Give us more information. Show the code you have for one import, and tell us if your csv files share the same structure or not. Also give us the necessary information about the filenames, so we can determine if wildcards could be helpful.

 

Big hint: one-liners like you posted are not likely to attract a quick solution. Help us to help you.

Reeza
Super User

@jayasubbareddy wrote:

i have already knowledge on Base sas i am expected sas macro 


Then you're aware that you don't need a macro to import multiple text files in a single data step. That you can use FILEVAR to specify the different file names as one option, or use a wildcard to read all files at once? And that you can use FILENAME option to capture the file name as well to track which records comes from which files? 

 

Show your current import code and we can help you to convert it to a macro if needed. 

andreas_lds
Jade | Level 19

Fortunately you are not the first one with such a problem, so you will find working code in the web.

 

If all files have the same structure, you don't need macro code, but wildcards in the infile statement. If you need to identify the files currently being processed, the infile-statemtn has an option for this.

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 645 views
  • 0 likes
  • 5 in conversation