BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Elliott
Obsidian | Level 7

I have a question, my company recently moved from SAS EG to Studio.  One of the features of EG that I really liked was the data import which wrote out the infile code with all the formats and lengths.  

 

I cannot figure out how to do that in SAS Studio.  All it does is the proc import, I need to know how to get the code for using infile.

 

Does anyone know how to do this in SAS Studio.

 

Thanks in advance,

Elliott

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Are you reading a text file (like a CSV)?  If so then PROC IMPORT will show the code it generated in the SAS log.  You can copy and paste it (you might need to remove some extra stuff inserted by the log) into the editor and clean up.

 

If you are reading from a Excel file then you cannot mimic what EG did.  In that case EG would actually convert the Excel file into a text file on your PC and upload the text file to SAS and read that in (at least that is what the old versions of EG did before SAS released the XLSX libname engine).

View solution in original post

4 REPLIES 4
Kurt_Bremser
Super User

When you use PROC IMPORT for a text file, the data step code is written to the log.

For file formats which can't be read with a data step (e.g. Excel), there will not be such code.

 

BTW you should not use PROC IMPORT for a text file. Write the data step yourself, according to the documentation of the file.

Tom
Super User Tom
Super User

Are you reading a text file (like a CSV)?  If so then PROC IMPORT will show the code it generated in the SAS log.  You can copy and paste it (you might need to remove some extra stuff inserted by the log) into the editor and clean up.

 

If you are reading from a Excel file then you cannot mimic what EG did.  In that case EG would actually convert the Excel file into a text file on your PC and upload the text file to SAS and read that in (at least that is what the old versions of EG did before SAS released the XLSX libname engine).

Reeza
Super User
Are you referring to an option to select that saved the program to a text file or the code that was generated in the log?
The log should still show the generated code, but I'm not sure if Studio has the option to have the code saved as well. If that's a feature you'd like to see you can also consider adding it to the SAS Ballot for consideration.

https://communities.sas.com/t5/SASware-Ballot-Ideas/idb-p/sas_ideas
SASKiwi
PROC Star

Try running PROC IMPORT after adding this statement: options source source2;

 

Then check the SAS log to see if the underlying DATA step code is showing.

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
  • 4 replies
  • 354 views
  • 1 like
  • 5 in conversation