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