BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
fieldsa83
Quartz | Level 8

I am trying to get several files that have the same layout in, but it will only keep data from the last file.

 

(note separate folders and file extensions)

 

Cannot figure it out!

 

data myfile;
infile   "/microdata/file1.prn" lrecl=430 missover
infile   "/microdata/otherfolder/file2.txt" lrecl=430 missover
infile   "/microdata/anotherfolder/file3.txt" lrecl=430 missover
        @119    AGE                     3.              /*      Age of respondent   */
        @122    SEX                     $1.             /*      Sex of respondent.      */
run;
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Might also try

filename ToRead ("/microdata/file1.prn", "/microdata/otherfolder/file2.txt",  "/microdata/anotherfolder/file3.txt");

and use

 

INFILE ToRead lrecl=430 missover;

 

There may be issues caused by column headers in the data files if present.

View solution in original post

2 REPLIES 2
AMSAS
SAS Super FREQ

Hi,

 

Take a look at the MEMVAR & FILEVAR options for the infile statement

Take a look at examples 10 & 13


ballardw
Super User

Might also try

filename ToRead ("/microdata/file1.prn", "/microdata/otherfolder/file2.txt",  "/microdata/anotherfolder/file3.txt");

and use

 

INFILE ToRead lrecl=430 missover;

 

There may be issues caused by column headers in the data files if present.

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!

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.

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
  • 2 replies
  • 540 views
  • 2 likes
  • 3 in conversation