Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3965012
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:24:19+00:00 2026-05-20T03:24:19+00:00

I have a bunch of csv files. Each has data from a different period:

  • 0

I have a bunch of csv files. Each has data from a different period:

filename file1 'JAN2011_PRICE.csv';
filename file2 'FEB2011_PRICE.csv';
...

Do I need to manually create intermediate datasets and then append them all together? Is there a better way of doing this?

SOLUTION

From the documentation it is preferable to use:

data allcsv;
       length fileloc myinfile $ 300;
       input fileloc $ ; /* read instream data       */

      /* The INFILE statement closes the current file 
         and opens a new one if FILELOC changes value 
         when INFILE executes                        */
       infile my filevar=fileloc 
              filename=myinfile end=done dlm=','; 

      /* DONE set to 1 when last input record read  */
       do while(not done);
      /* Read all input records from the currently  */
      /* opened input file                          */
         input col1 col2 col3 ...;
         output;
       end;
       put 'Finished reading ' myinfile=; 
datalines;
path-to-file1
path-to-file2
...
run;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T03:24:20+00:00Added an answer on May 20, 2026 at 3:24 am

    To read a bunch of csv files into a single SAS dataset, you can use a single data step as described in the SAS documentation here. You want the second example in this section which uses the filevar= infile option.

    There should be no reason to create intermediate datasets.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bunch of pretty large CSV (comma separated values) files and I
I have a bunch of perfmon files that have captured information over a period
I have a bunch of emails, each separated by a comma (,) (not csv).
I have a bunch of files that I need to be able to transport
I have a bunch (hundreds) of files that are supposed to have Unix line
I have a bunch of PDF files and my Perl program needs to do
I have a bunch of folders and subfolders. Each one contains, amongst other things,
Does Java and/or Spring have the concept of properties? I have bunch of domain
I have a bunch of latitude/longitude pairs that map to known x/y coordinates on
I have a bunch of .NET frameworks installed on my machine. I know that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.