BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

Dear

 How to get 'l_bin' and 'U_bin' values in ods output dataset='m2'  in method 2  similar to variables I got in method 1  'm1

data cc;
aval_=1;
output;
aval_=0;
output;
run;
/* method 1 */
proc freq data=cc;

tables aval_/binomial(level='1');
output out=m1 binomial;
run;
/* method 2 */
ods trace on;
ods output onewayfreqs = dd binomialcls=m2;
proc freq data=count1;
/* where aval > .; */
tables aval_/binomial(exact) alpha=0.05;
run;

' dataset. Please suggest thank you

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hello @knveraraju91,

 

Add the WALD keyword to the list of BINOMIAL options:

 

ods output binomialcls=m2;
proc freq data=cc;
tables aval_ / binomial(level='1' exact wald);
run;

Dataset M2 will then contain a second observation with Type='Wald' and LowerCL and UpperCL values matching the values of L_BIN and U_BIN, respectively, of the M1 dataset (while the observation with Type='Clopper-Pearson (Exact)' corresponds to variables XL_BIN and XU_BIN in dataset M1).

 

ballardw
Super User

First, use the same data set. Your code for method 2 points to a different data set than method 1.

 

Use cl=Wald for the binomial option to get the same values, different variable names though, at least for your example.

 

ods output onewayfreqs = dd binomialcls=m2;
proc freq data=cc;
/* where aval > .; */
tables aval_/binomial(cl=wald )  alpha=0.05;
run;

Note that the binomialcls output dataset includes a variable TYPE that indicates the calculation used. If you want both the Exact and another method (or more) then use additional Tables statements:

ods output onewayfreqs = dd binomialcls=m2;
proc freq data=cc;
/* where aval > .; */
tables aval_/binomial(exact )  alpha=0.05;
tables aval_/binomial(cl=wald )  alpha=0.05;
run;

Note that other processing would be needed to reduce this to a single observation per table statement ( and you can have many!) or combinations of variables.

 

 

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 578 views
  • 2 likes
  • 3 in conversation