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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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