BookmarkSubscribeRSS Feed
mspeed42
SAS Employee

With SAS Studio, Is there an easy way to read in a fixed width format .txt file?

Thanks

6 REPLIES 6
ballardw
Super User

Do you have a document with column descriptions such as variable name start -end column for each field and the data format (currency, date, time, datetime, numeric, numeric with implied decimals, text)?

mspeed42
SAS Employee
Yes, I have all that - I am trying to avoid writing code. I am look for a Wizard like we have in EG
Reeza
Super User
You have to write code for fixed width files because SAS can't tell where a variable will start and end. If your documentation is structured well you can usually use Excel to help write the code.

Or you can try and write some code that reads the specifications and develops the import code.
mspeed42
SAS Employee

Thanks - SAS STUDIO does not have a point and click for fixed width files.

AmyP_sas
SAS Employee

Just so you know, there's a lot we want to do to the Import Tool.  Right now it can handle basic importing of common file types and generates PROC IMPORT code.  Seemed like a good place to start.  But ulitmately, I'd love to have a "DATA step generator" that would allow you to view a sample of your raw file and help you build the INPUT statement for it.  We don't have that yet.  I'd love to hear any ideas or pointers to any good examples of something similar out there.

Peter_C
Rhodochrosite | Level 12
Hi Amy
I helped "industrialize" an data step import routine. However, that was for a collection of csv files for which the definition were provided in very similar structure to OUT= of the CONTENTS Procedure.
A form for defining the old fashioned fixed layout should (just about) be simpler..... but seems hard to visualise the way to support the maximum number of columns a table can have. Is there a way to insert "another page" of definitions.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 3900 views
  • 0 likes
  • 5 in conversation