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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 2642 views
  • 0 likes
  • 5 in conversation