BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
MaryA_Marion
Lapis Lazuli | Level 10

I am running the following autoexec before calling a macro. I usually just have the output go to the default window so I am not specifying html or pdf in the code itself although it is listed in the preferences.

AUTOEXEC.SAS
%LET sasworklocation="/folders/myfolders/";
ODS LISTING GPATH=&sasworklocation; 
/* ODS STATEMENTS */
ods path reset; 
ods _ALL_ close; 
ods trace off;
ods listing; 
ods noptitle; 
ods graphics on;

*INITIALIZATION 
proc printto; run;  

I am following the autoexec with a call to a macro but I suspect that the macro itself initiates the table of content output. That is what is happening on the code I am working with. A display of unwanted table of content data appears in the results window. How can I stop that from happening when running SAS University? It greatly increases output size. I got it to stop once when I changed the preferences but it is back in again. The following statement added to the macro does not work.

ODS html5 exclude toc 

The error message says:

 html5 destination is not active  

I need something similar to this ???

I don't want to output to pdf or rtf for simplicity. I just want to open sas studio /sas university, code, and get output to the screen.

By the way, why am I not getting an output window as well?

Thanks. MM

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

The easiest thing is to use PROC DELETE if you want to delete a dataset. Then code it clearer and it runs faster.

proc delete data=work.meansout; run;

Or you could add the NOLIST option to your PROC DATASETS statement.

 

View solution in original post

12 REPLIES 12
Cynthia_sas
Diamond | Level 26
Hi:
Without seeing ALL of your code, it is hard to comment.
Cynthia
Quentin
Super User

Did you look into the macro definition to see if it does indeed initiate the TOC?  If the macro is generating code that explicitly creates a TOC, I would think the answer would be to modify the macro  (perhaps add a parameter that allows you to turn the TOC on/off).  If the macro does not ask for TOC, then I would look at the log to see the ODS statement generated by studio, to see if that is what is adding the TOC.

 

Maybe a simple test would be submit something like:

%macro printit(data);
  proc print data=&data (obs=5);
  run;
%mend printit;

%printit(sashelp.shoes)
%printit(sashelp.class)

If you run that, and studio creates a TOC, you will know it's not the code generated by the macro.  And you'd have a simple log to look at to see what code is asking for the TOC.  I haven't used Studio.  I'm assuming that, similar to EG, you can set an option to make sure that the wrapper code generated by studio is shown in the log.

MaryA_Marion
Lapis Lazuli | Level 10
TOC is actually not correct. It is directory information and library members that are outputting. I need to put that to the log one time, not the 8 times it is done at the start of the program. It is also done later on.
MaryA_Marion
Lapis Lazuli | Level 10
SAS is actually creating directory information and library member information not toc. I read the output window incorrectly. I need to turn this off somehow. Thank you for your reply. I am paying more attention to the log now.
Tom
Super User Tom
Super User

The last picture that you copied into a PDF and then attached (why not just use the Insert Photo icon on the editor to put the picture in your post?) is the output of PROC CONTENTS.

 

Find where the PROC CONTENTS code is.  If you need it to produce an output dataset you can add the NOPRINT option to stop it from also producing the report.  If you don't need it to produce an output dataset then just remove it.

proc contents data=sashelp.class out=contents noprint;
run;

 

MaryA_Marion
Lapis Lazuli | Level 10
there is no proc contents code....Strange!
Tom
Super User Tom
Super User

The CONTENTS statement inside of PROC DATASETS can generate PROC CONTENTS output also.

MaryA_Marion
Lapis Lazuli | Level 10
Only one proc datasets in code, mmeans2 is called multiple times. How to modify?

%macro mmeans2(dsname,varlst,stat);
proc datasets library=work; delete meansout; run;
proc means data=&dsname noprint;
var &varlst;
output out=meansout
n=n nmiss=nmiss mean=mean Std=Std min=min max=max range=range
sum=sum var=var uss=uss css=css Stderr=Stderr cv=cv
/* skewness=skewness kurtosis=kurtosis sumwgt=sumwgt */
t=t prt=prt;
run;
...
Tom
Super User Tom
Super User

The easiest thing is to use PROC DELETE if you want to delete a dataset. Then code it clearer and it runs faster.

proc delete data=work.meansout; run;

Or you could add the NOLIST option to your PROC DATASETS statement.

 

MaryA_Marion
Lapis Lazuli | Level 10
Tom,
Thank you. I needed to learn to read what followed table of contents in the results window. I notice there is a contents noprint option to proc datasets. I did not seem to need it however. 5 stars! MM
MaryA_Marion
Lapis Lazuli | Level 10
Where is this insert photo icon? Do I need to go interactive? Are you referring to a SAS U window?
Tom
Super User Tom
Super User

It is right on the menu when editing your post.  Along with the Insert Code and Insert SAS Code buttons.

image.png

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 12 replies
  • 4314 views
  • 6 likes
  • 4 in conversation