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
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).
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.
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).
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.