OPTIONS LINESIZE=88 PAGESIZE=53 NOCENTER NODATE NONUMBER NOFMTERR; *************************************************************************; * PROJECT NAME: Learning to Use SAS ; * PROGRAM NAME DATE PROGRAMMER ; TITLE1 "Source:lec24p4.sas C:\ed\web\be691f\webready 11/30/98 EJS " ; * Description: Program simulates 50 selections of a sample of n=7 from a ; * binomial distribution with n=7, p=.2 ; *************************************************************************; ***********************************; *** Generate 7 binomial RV and ; *** estimate sample proportion ; ***********************************; DATA d; p=0.2; n=7; ntrials=1; DO I=1 to ntrials; x_m=RANBIN(3333,7,p)/n; LABEL x_m= 'Sample proportion'; OUTPUT; END; PROC PRINT DATA=d LABEL; TITLE2 "Table 3.1. List of binomial sample with n=7, p=0.2"; ***********************************; *** Generate 7 binomial RV and ; *** estimate sample proportion ; *** for 50 trials ; ***********************************; DATA d; p=0.2; n=7; ntrials=50; DO trial=1 to ntrials; x_m=RANBIN(3333,7,p)/n; LABEL x_m= 'Sample proportion'; OUTPUT; END; PROC PRINT DATA=d LABEL; ID trial; VAR x_m; TITLE2 "Table 3.2. Listing of 50 Normally Distributed Random Variables with"; TITLE3 " mean = 0.2, and standard error = 0.151"; PROC CHART; HBAR x_m /TYPE=PERCENT MIDPOINTS=0 TO 1 BY 0.05; TITLE2 "Table 3.3. Chart of 50 random variables from a Normal Distribution mean=0.2, SE=0.151"; RUN;