Desktop productivity for business analysts and programmers

How to create a dataset from ODS Table without displaying SAS report?

Reply
Super Contributor
Super Contributor
Posts: 365

How to create a dataset from ODS Table without displaying SAS report?

Hello,
Let us consider the following example, taken from SAS Help:
Example 14.6: Creating an Output Data Set from an ODS Table
data insure;
  input n c car$ age;
  ln = log(n);
 
datalines;
  
500   42  small  1
  
1200  37  medium 1
  
100    1  large  1
  
400  101  small  2
  
500   73  medium 2
  
300   14  large  2
   ;
run;
/* SAS Help: "The purpose of the following statements is to obtain the names of the output
tables produced in this PROC GENMOD run. The ODS TRACE statement lists the
trace record, and the SAS listing destination is closed so that no output
is displayed." */

/* Begin */;
ods trace on;
ods listing close;
proc genmod data=insure;
  class car age;
  model c = car age / dist   = poisson
   
link   = log
   
offset = ln
   
obstats;
run;
ods trace off;
/* End */;
ods output ObStats=myObStats
  (keep=car age pred
  rename=(pred=PredictedValue));
proc genmod data=insure;
  class car age;
  model c = car age / dist   = poisson
   
link   = log
   
offset = ln
   
obstats;
run;
It works without any errors on my EG 4.3 but does not react on ods listing close;.
I still getting normal output (SAS report) from the code section between /* Begin */; and /* End */;
Please help.
Trusted Advisor
Posts: 2,114

How to create a dataset from ODS Table without displaying SAS report?

A SAS Report is not an ODS listing file.  When I submit the code, I get this line added

ODS tagsets.sasreport12(ID=EGSR) FILE=EGSR STYLE=Plateau

12       ! STYLESHEET=(URL="file:///C:/Program%20Files/SAS/EnterpriseGuide/4.3/Styles/Plateau.cs

12       ! s") NOGFOOTNOTE GPATH=&sasworklocation ENCODING=UTF8 options(rolap="on");

by EGuide.  I think that you need to close that to eliminate the SAS Report.

Doc Muhlbaier

Duke

Super Contributor
Super Contributor
Posts: 365

How to create a dataset from ODS Table without displaying SAS report?

Thanks for additional info. I also see "ODS tagsets.dsasreport12 etc." in my LOG.

You wrote "I think that you need to close that to eliminate the SAS Report". How to do that?

SPR

Trusted Advisor
Posts: 2,114

How to create a dataset from ODS Table without displaying SAS report?

Didn't know, but since you asked, it is an easy google search:

ods tagset close site:sas.com

Super Contributor
Super Contributor
Posts: 365

How to create a dataset from ODS Table without displaying SAS report?


Hello Doc@Duke,

Using your suggestions I made some progress, namely

ODS _ALL_ Close;

closes all open destinations, which is good. However, I can not figure out how to open SASREPORT12 tagset again. Using

ODS markup tagset=sasreport12;

produces an error pointing to unsuficient authorization to access sasreport12.xml. This is expected because I

have no access to SAS server.

Any help?

Super Contributor
Super Contributor
Posts: 365

Re: How to create a dataset from ODS Table without displaying SAS report?

Additional experimenting resulted in a solution (not very elegant I think):

data insure;
  input n c car$ age;
  ln = log(n);
  datalines;
   500   42  small  1
   1200  37  medium 1
   100    1  large  1
   400  101  small  2
   500   73  medium 2
   300   14  large  2
   ;
run;
ods _all_ close; /* Closes all output */
ods output ObStats=myObStats (keep=car age pred
  rename=(pred=PredictedValue)); /* Creates dataset MyObStats without displaying any output  */
proc genmod data=insure;
  class car age;
  model c = car age / dist   = poisson
    link   = log
    offset = ln
    obstats;
run;

proc print data=insure; /* Does not produce output  because output is closed */
run;

/*  Returns Sasreport back */
ODS tagsets.sasreport12(ID=EGSR) FILE=EGSR STYLE=Plateau
STYLESHEET=(URL="file:///C:/SAS92/EnterpriseGuide/4.3/Styles/Plateau.css")
NOGTITLE NOGFOOTNOTE GPATH=&sasworklocation ENCODING=UTF8 options(rolap="on");
proc print data=insure; /* Displays SASreport  */
run;

I guess that

ODS tagsets.sasreport12(ID=EGSR) FILE=EGSR STYLE=Plateau
STYLESHEET=(URL="file:///C:/SAS92/EnterpriseGuide/4.3/Styles/Plateau.css")
NOGTITLE NOGFOOTNOTE GPATH=&sasworklocation ENCODING=UTF8 options(rolap="on");


depends on specific SAS installation. This ODS statement is produced by EG 4.3 if one checks

TOOLS/Options/Results General/Show generated wrapper code in SAS log.

Ask a Question
Discussion stats
  • 5 replies
  • 298 views
  • 6 likes
  • 2 in conversation