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

I have a large, multi-GB .txt file to import into SAS. (my SAS is running on a remote server)

 

First, I FTP transferred my .txt file to the server itself.

 

Next, I launched the Import Wizard from my local E.G. client, but whats happening is   "Retrieving Source File" - which is silly because the data is already there. 

 

How can I import the .txt file most efficiently? I am aware of proc IMPORT but then I lose the ability to review the datatypes during the EG wizard. 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Is this a one time process?

 

In general, it's best to use a data step to read the file, but that means explicitly listing fields/types.

The 'lazy trick' is to use proc import, most likely with option obs= set to generate the code.

Take the code from the log, review and customize the code as desired and run from there.

 

option obs=100000;

proc import ...

run;

 

Grab code from log and you're good to go. You can use ALT+Click to select code without log numbers.

Press the ALT key and at the same time select the top left-hand corner of your log in the column just to the right of your line numbers by clicking with your mouse button. Now drag the mouse down to the bottom right-hand corner of your log. You should now have highlighted your SAS program without the line numbers.

Courtesy of @SASKiwi

https://communities.sas.com/t5/SAS-Procedures/How-to-remove-log-numbers/td-p/21489

 

View solution in original post

4 REPLIES 4
Reeza
Super User

Is this a one time process?

 

In general, it's best to use a data step to read the file, but that means explicitly listing fields/types.

The 'lazy trick' is to use proc import, most likely with option obs= set to generate the code.

Take the code from the log, review and customize the code as desired and run from there.

 

option obs=100000;

proc import ...

run;

 

Grab code from log and you're good to go. You can use ALT+Click to select code without log numbers.

Press the ALT key and at the same time select the top left-hand corner of your log in the column just to the right of your line numbers by clicking with your mouse button. Now drag the mouse down to the bottom right-hand corner of your log. You should now have highlighted your SAS program without the line numbers.

Courtesy of @SASKiwi

https://communities.sas.com/t5/SAS-Procedures/How-to-remove-log-numbers/td-p/21489

 

JBerry
Quartz | Level 8

Still a pain - that the client needs to bring back all the data like that -  but your "lazy" trick is incredible and I very much appreciate it! 

The added bonus is the Alt+Click trick, which I am sure will serve me well many times in my career.

 

Thanks!

Reeza
Super User

If your lucky 😉 your client may have provided a data transfer agreement with the data specifications. If so, I usually find a way to create my informat/input statements from that. There's a variety of ways - usually I use Excel to build it since I can customize and make it semi-automated manner. 

JBerry
Quartz | Level 8
No such luck. : ( What started off as a favor has turned into a full blown project. Thanks for the pro tips!


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
  • 4 replies
  • 1228 views
  • 2 likes
  • 2 in conversation