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
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).
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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.