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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 2 replies
  • 151 views
  • 2 likes
  • 3 in conversation