Desktop productivity for business analysts and programmers

how to use "ods output" statement in sas enterprise?

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 128
Accepted Solution

how to use "ods output" statement in sas enterprise?

In the original SAS program, I could use "ods output" to export some of the results from some Proc procedures, I could make those p-values from t-tests, or means or SDs into a new data sets

For example:

ods output "Summary statistics"=means;

proc means data=meg1 mean stderr q1 q3;

class num velocity;

var p;

run;

ods output close;

In this step I can export the Proc means result in to dataset "means". I could see "Summary statistics" was listed on the left side for the SAS program "Result" window, so I could use the ODS OUTPUT statement to export it into a new data set.

But in SAS enterprise guide there is no such "result" window, how can I do it? How to export procedure results into new datasets?

Thanks!


Accepted Solutions
Solution
‎07-19-2013 12:30 PM
Super Contributor
Posts: 333

Re: how to use "ods output" statement in sas enterprise?

I see the issue now.

There are a couple of ways to find the "ODS Name" for the printed output. I usual just use the place ods trace on; and ods trace off; around the procedure code im coverting to a dataset. This will place in the log some added information regarding the procedure. The label in the output added section is the keyword to use to select the piece of output for the dataset. If the procedure has multiple pieces like reg, glm, logistics, etc in the output there will be a group describing each each allowing you to select the section you want in the dataset.

AS AN Example:

ods trace on;

ods output "Summary Statistics" = means;

proc means data= sashelp.class mean;

class sex;

var age;

run;

ods output clear;

ods trace off;

FROM THE LOG:

Output Added:

-------------

Name:        Summary

Label:         Summary statistics

Template:   base.summary

Path:          Means.Summary

-------------

Additional most of the procs Ive used with this has a section in the SAS documentation the lists this information as well. Of course I find it easier to use the code than scroll through the documentation.

EJ

View solution in original post


All Replies
Super Contributor
Posts: 333

Re: how to use "ods output" statement in sas enterprise?

I dont think it works any differently in EG. If you write the same code in EG the dataset will appear in the work directory just as in the Display Manager version of SAS (regular SAS). I just tried it and it acted as what Im used to in regular SAS.

Have you tried the code in EG? Did you get an error that you can post?

EJ

Frequent Contributor
Posts: 128

Re: how to use "ods output" statement in sas enterprise?

Hi, esjackso1. Sorry that I did not myself clear.

I did try the same code in EG, and it worked well.

My question is: How can I know the name for the procedure result, (for example "Summary statistics" in PROC MEANS).

In the regular SAS I can look this up from the left "result" window. but in EG I don't know where I can find the procedure result name that I can use for the ODS OUTPUT statement. I couldn't always remember all those procedure result names.

Thanks Smiley Happy

Grand Advisor
Posts: 17,396

Re: how to use "ods output" statement in sas enterprise?

In the documentation for SAS, there's usually under details the ODS Table Names:

So you do need to know the proc you're looking for, but other than that can look it up.

Base SAS(R) 9.3 Procedures Guide: Statistical Procedures, Second Edition

Also, many EG Procs have an option to create an output dataset with the details stored, you just need to check the right box Smiley Happy

Solution
‎07-19-2013 12:30 PM
Super Contributor
Posts: 333

Re: how to use "ods output" statement in sas enterprise?

I see the issue now.

There are a couple of ways to find the "ODS Name" for the printed output. I usual just use the place ods trace on; and ods trace off; around the procedure code im coverting to a dataset. This will place in the log some added information regarding the procedure. The label in the output added section is the keyword to use to select the piece of output for the dataset. If the procedure has multiple pieces like reg, glm, logistics, etc in the output there will be a group describing each each allowing you to select the section you want in the dataset.

AS AN Example:

ods trace on;

ods output "Summary Statistics" = means;

proc means data= sashelp.class mean;

class sex;

var age;

run;

ods output clear;

ods trace off;

FROM THE LOG:

Output Added:

-------------

Name:        Summary

Label:         Summary statistics

Template:   base.summary

Path:          Means.Summary

-------------

Additional most of the procs Ive used with this has a section in the SAS documentation the lists this information as well. Of course I find it easier to use the code than scroll through the documentation.

EJ

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 269 views
  • 1 like
  • 3 in conversation