Write and run SAS programs in your web browser

How to convert HTML to listing

New User
Posts: 1

How to convert HTML to listing



Please let me know how to convert the software settings from HTML to listing.

SAS Employee
Posts: 449

Re: How to convert HTML to listing

Posted in reply to kondapalli



By default SAS Studio does not actually create listing output. SAS Studio uses ODS behind the scenes to initially create HTML output but also gives you the option of saving your output in RTF and PDF formats as well. But if desired, you can still create listing output in SAS Studio and save this listing output to a file. Here are a few options for you...


One option is to wrap ODS Listing statements around your code (using the FILE= option on the initial ODS Listing statement to tell SAS where to writes its listing output to). Here is a simple example...


ods listing file='/tmp/sasstudio.lst';
title1 'Output from SAS Studio';
proc print data=sashelp.class;
ods listing close;


Another option is to use PROC PRINTTO, such as:


proc printto new print='/tmp/sasstudio1.lst'; run;
title1 'More output from SAS Studio';
proc print data=sashelp.class; run;
proc printto; run;



Via SAS code in SAS Studio, you can redirect the log to a file using a PROC PRINTTO step at the top of your code similar to:

proc printto new log="/tmp/sasstudio.log";run;

And then to close the log, at the end of your code, use:

proc printto; run;

But, as currently designed, when you use PROC PRINTTO as shown above, while this step does write the log to a file, at the same time it prevents SAS Studio from displaying the log information in the SAS Studio log window. There is currently not a way to use PROC PRINTTO with the log option and have it do both. But you will see the same behavior with both SAS and SAS Studio.

Super User
Posts: 22,010

Re: How to convert HTML to listing

Posted in reply to kondapalli

I suspect your asking this because you're using some reference material that has the listing output. I would strongly recommend you stick with HTML because it's pretty much the new standard. Listing is usually faster, but writing to an external file that you have to open separately is probably longer. 

Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation