BookmarkSubscribeRSS Feed
Pooja98
Fluorite | Level 6

I have 20 csv files, need to import and append the 20 CSV files in SAS using DO loop.

The file name as follow:

Part-00000-sample file- set 12589

Part-00001-sample file- set 12590

Part-00002-sample file- set 12591

Part-00003-sample file- set 12592

etc....

 

i need to import the 20csv files using do loop. As for importing need a double loop, need a help for this?

 

TIA

3 REPLIES 3
ChrisHemedinger
Community Manager

Are the files in one directory and named similar enough for a wildcard? See this article for an example.

 

This example is for tab-delimited.

 

data accel;
  infile "/home/my-id/tsv/*.tsv" 
   dlm='09'x;
  length counter 8 
         timestamp 8 
         x 8 y 8 z 8 
         filename $ 25;
  input counter timestamp x y z filename;
run;

 

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 1247 views
  • 1 like
  • 4 in conversation