BookmarkSubscribeRSS Feed
Junyong
Pyrite | Level 9

In my desktop, the following code doesn't show the sgplot results in SAS and just saves the drawn gspc.pdf quietly. In SAS OnDemand, the code doesn't suppress the results while running.

data gspc;
	infile 'https://query1.finance.yahoo.com/v7/finance/download/^gspc?period1=-9999999999&period2=9999999999&interval=1mo' url firstobs=2 dsd truncover;
	input date yymmdd10. +1 open hi lo close adj vol;
run;

ods html select none;
ods results=off;
ods listing gpath="/home/junyong0/";
ods graphics/reset imagename="gspc" imagefmt=pdf noborder;

proc sgplot;
	series x=date y=adj;
	xaxis valuesformat=year4.;
	yaxis valuesformat=best4. type=log;
run;

ods graphics/reset;
ods listing gpath=none;
ods results=on;
ods html select all;

How can I suppress the sgplot results in SAS OnDemand?

9 REPLIES 9
Reeza
Super User

I’m guessing they’re not the same SAS version? 

The imagefmt Option has changed to outputfmt in 9.4. 

What does the log show for both systems?

 


@Junyong wrote:

In my desktop, the following code doesn't show the sgplot results in SAS and just saves the drawn gspc.pdf quietly. In SAS OnDemand, the code doesn't suppress the results while running.

data gspc;
	infile 'https://query1.finance.yahoo.com/v7/finance/download/^gspc?period1=-9999999999&period2=9999999999&interval=1mo' url firstobs=2 dsd truncover;
	input date yymmdd10. +1 open hi lo close adj vol;
run;

ods html select none;
ods results=off;
ods listing gpath="/home/junyong0/";
ods graphics/reset imagename="gspc" imagefmt=pdf noborder;

proc sgplot;
	series x=date y=adj;
	xaxis valuesformat=year4.;
	yaxis valuesformat=best4. type=log;
run;

ods graphics/reset;
ods listing gpath=none;
ods results=on;
ods html select all;

How can I suppress the sgplot results in SAS OnDemand?


 

Ksharp
Super User
ods _all_ close;
Junyong
Pyrite | Level 9

This works. Thanks. Should I ods _all_ open to reverse and reopen the html?

ballardw
Super User

@Junyong wrote:

This works. Thanks. Should I ods _all_ open to reverse and reopen the html?


No, you have to explicitly state which ODS destinations you want open.

 

There are something like 20 ODS destinations supplied by SAS, depending on licensed modules, and I doubt that you would actually want that many open

Junyong
Pyrite | Level 9

This is the most curious part—which ods should I turn off in proc sgplot? I tried ods select none (+ods select all) and ods html close (+ods html) to temporarily suppress it, but they don't work. I need the file but don't need the resultant SAS pop-up.

Ksharp
Super User
No need to reopen if you don't want .
The following code could reopen ods destination .

ods html ;

ods listing ;
Junyong
Pyrite | Level 9

SAS OnDemand uses neither listing nor html. I tried the following based on Knowing which ODS destination is currently open.

 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 NOTE: ODS statements in the SAS Studio environment may disable some output features.
 71         
 72         ods listing show;
 ERROR: The LISTING destination is not active; no select/exclude lists are available.
 73         ods html show;
 ERROR: The HTML destination is not active; no select/exclude lists are available.
 74         
 75         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 86         

So ods _all_ close cannot be reversed by ods listing and ods html—which ods destination does SAS OnDemand use for proc sgplot?

I do NOT want to turn off everything.

I want to just close and open back and forth just for the sgplot.

The following code does not print the sgplot results in the desktop because the desktop SAS uses the ods html and the capitalized parts turn off it.

data gspc;
	infile 'https://query1.finance.yahoo.com/v7/finance/download/^gspc?period1=-9999999999&period2=9999999999&interval=1mo' url firstobs=2 dsd truncover;
	input date yymmdd10. +1 open hi lo close adj vol;
run;

ODS HTML SELECT NONE;
ODS RESULTS=OFF;
ods listing gpath="!userprofile\desktop\";
ods graphics/reset imagename="gspc" imagefmt=pdf noborder;

proc sgplot;
	series x=date y=adj;
	xaxis valuesformat=year4.;
	yaxis valuesformat=best4. type=log;
run;

ods graphics/reset;
ods listing gpath=none;
ODS RESULTS=ON;
ODS HTML SELECT ALL;

This code, however, does not suppress the sgplot results in SAS OnDemand, which uses neither listing nor html.

Reeza
Super User
Sounds like it's time for a tech support question?
Ksharp
Super User
ods graphics off;

could close ODS Graph

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 9 replies
  • 1641 views
  • 0 likes
  • 4 in conversation