Quantcast
Channel: Statistics Help @ Talk Stats Forum - SAS
Viewing all articles
Browse latest Browse all 310

How to write code for confidence interval?

$
0
0
Hi,
I've got a data set with among other things the variables for gender (M/F, i.e. 0 and 1) and for voting (yes/no, i.e. 0 and 1). I now need a confidence interval (CLM, LCLM and UCLM) for the proportion of men voting yes (and also the women voting yes).

Just don't seem to be able to figure out what to do!

The only example in the text book is an exercise whereby we created a random sample, and did CL. Code for random sample:
data work.random;
do sample = 1 to 100;
do obs = 1 to 100;
x=ranuni (571224);
if 0 <=x<=0.1 then nummer = 1;
else nummer=0;
output;
end;
end;
run;


Code for CL:
proc means data=work.random CLM mean alpha=0.05;
output out=work.intervals LCLM=lower UCLM=upper;
var nummer;
by sample;
run;


This I get to work. Thought I could use the same code for running a CL on "my" dataset, let's call it "election.xls" and simply change "var nummer" to "var voting" and "by sample" to "by gender". But it's not working.

What am I doing wrong? Is there another step I need to take with my two variables?
Any help is much appreciated!

Viewing all articles
Browse latest Browse all 310

Trending Articles