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

How can I convert output (.lst) file to xlsx format?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Whilst I totally agree with @Reeza and @Kurt_Bremser, create your output from SAS using the tools to create Excel files, you can import text (which is what a .lst file is) into Excel and process it if you really have to.  Open Excel, goto Data->From Text, select your file (as its not .txt you will need to select All Files *.* in the filetypes box).  You will then see the Text Import Wizard, where you can set various options, delimiters, widths etc.  

 

Do note, that .lst files are just raw text, so there would be no formatting, and strcuturally it isn't the best to deal with.  Better to generate a proper report from SAS.

View solution in original post

4 REPLIES 4
Reeza
Super User

You can't directly. 

 

If you're on SAS 9.4 though you can use ODS EXCEL to create an Excel file. 

 

You add 

 

ods excel file='file path/name.xlsx;

 

your sas code;

 

ods excel close;

 

This will produce an excel file with your results. You can create PDF or RTF/Word files in a similar manner. 

HossainZ
Calcite | Level 5

Thanks Reza.

When I run sas code only, it works fine. When I add your suggested lines at the beginning and end, I get error messages. Possibly I need to work on it a bit more.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Whilst I totally agree with @Reeza and @Kurt_Bremser, create your output from SAS using the tools to create Excel files, you can import text (which is what a .lst file is) into Excel and process it if you really have to.  Open Excel, goto Data->From Text, select your file (as its not .txt you will need to select All Files *.* in the filetypes box).  You will then see the Text Import Wizard, where you can set various options, delimiters, widths etc.  

 

Do note, that .lst files are just raw text, so there would be no formatting, and strcuturally it isn't the best to deal with.  Better to generate a proper report from SAS.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1224 views
  • 4 likes
  • 4 in conversation