BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
HitmonTran
Pyrite | Level 9

Hello,

How do i output the binomial test into a dataset?

 

Thank you!

 

%macro yesci (var= ,trt=, p= , out=);

proc freq data=mrg2;

where trt01pn in (&trt);

tables &var / binomial(p=&p level="Y") out=&out; 

run;

%mend yesci;

 

%yesci (var=cat6, trt=2 , p=0.242, out=cat6_trt2 );

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

The generic skill is to use the ODS Trace option:

<dummy code>

ods trace on;

proc whatever <options>;
run;

ods trace off;

Your log will show the names of the output objects.

Example you can run:

ods trace on;

proc freq data=sashelp.class;
tables sex / binomial;
run;

ods trace off;

The log shows:

Output Added:
-------------
Name:       OneWayFreqs
Label:      One-Way Frequencies
Template:   Base.Freq.OneWayFreqs
Path:       Freq.Table1.OneWayFreqs
-------------

Output Added:
-------------
Name:       Binomial
Label:      Binomial Proportion
Template:   Base.Freq.BinomialStatFactoid
Path:       Freq.Table1.Binomial
-------------

Output Added:
-------------
Name:       BinomialTest
Label:      Binomial Proportion Test
Template:   Base.Freq.BinomialStatFactoid
Path:       Freq.Table1.BinomialTest
-------------

You would use the bit(s) with the Name: in and ODS OUTPUT statement with <name>=<your data set name> pairs for the desired objects:

ods output BinomialTest= mybinomialtestdataset;
proc freq data=sashelp.class;
tables sex / binomial;
run;

 

OR read the online help for the procedure. The Details section should have an ODS TABLE NAMES section that will have the name of the table (i.e. BinomialTest) and the option(s) required to create it.

 

 

View solution in original post

2 REPLIES 2
ballardw
Super User

The generic skill is to use the ODS Trace option:

<dummy code>

ods trace on;

proc whatever <options>;
run;

ods trace off;

Your log will show the names of the output objects.

Example you can run:

ods trace on;

proc freq data=sashelp.class;
tables sex / binomial;
run;

ods trace off;

The log shows:

Output Added:
-------------
Name:       OneWayFreqs
Label:      One-Way Frequencies
Template:   Base.Freq.OneWayFreqs
Path:       Freq.Table1.OneWayFreqs
-------------

Output Added:
-------------
Name:       Binomial
Label:      Binomial Proportion
Template:   Base.Freq.BinomialStatFactoid
Path:       Freq.Table1.Binomial
-------------

Output Added:
-------------
Name:       BinomialTest
Label:      Binomial Proportion Test
Template:   Base.Freq.BinomialStatFactoid
Path:       Freq.Table1.BinomialTest
-------------

You would use the bit(s) with the Name: in and ODS OUTPUT statement with <name>=<your data set name> pairs for the desired objects:

ods output BinomialTest= mybinomialtestdataset;
proc freq data=sashelp.class;
tables sex / binomial;
run;

 

OR read the online help for the procedure. The Details section should have an ODS TABLE NAMES section that will have the name of the table (i.e. BinomialTest) and the option(s) required to create it.

 

 

Ksharp
Super User
proc freq data=mrg2;

where trt01pn in (&trt);

tables &var / binomial(p=&p level="Y") ;
output out=&out binomial ;
run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 217 views
  • 0 likes
  • 3 in conversation