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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

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