BookmarkSubscribeRSS Feed
datalligence
Fluorite | Level 6
I have this .rpt file of about 100,000 records. I want to directly read or import this into SAS. The data is of fixed width type where fields are aligned in columns with spaces bewteen each field.

When the file size was smaller, or the # of records were less I was able to import it into excel, save it as a tab-delimted text file and then import it directly into SAS. There are a lot of fields/variables and I don't want to use column inputs+informats for such a long list of variables, so how do i import/read this .rpt file into SAS?

And can I use infile statement with column and informat specifications if there is no other option?

Thanks,
Romakanta
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12
Yes. When SAS started (and was still known as the "Statistical Analysis System") that's the way almost all data came in. If it really is fixed columns with spaces, you can just list the variables in order. Check the documentation for the INPUT statement for details of addressing character variables and how to address missing data.

Another approach would be to read the data as one long character string, use the Perl regular expressions (in SAS) to replace every set of one or more blanks with a TAB, write it out, and then re-read it as tab delimited.

Doc Muhlbaier
Duke
deleted_user
Not applicable
Have you tried in EG the "File, Import Data ..." menu selection?

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 4095 views
  • 0 likes
  • 3 in conversation