Created
September 29, 2021 18:29
-
-
Save MJacobs1985/36c4f8a164f22827e142473ed8c8b50d to your computer and use it in GitHub Desktop.
Simulations in SAS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%let ErrorVariance=2720; | |
%let BlockVariance=4851; | |
%let block=20; | |
%let nsim=1; | |
DATA RCBD; | |
call streaminit(123); | |
do isim = 1 to ≁ | |
do block=1 to █ | |
rndBlock=rand("Normal",0,sqrt(&BlockVariance)); /* create block specific deviates */ | |
do trt=1 to 2; | |
do animal=1 to 2; | |
if trt=1 then y=791.5 + rndBlock + rand('Normal', 0, sqrt(&ErrorVariance)); /* mean + block + error */ | |
if trt=2 then y=818.4 + rndBlock + rand('Normal', 0, sqrt(&ErrorVariance)); | |
output; | |
end; | |
end; | |
end; | |
end; | |
proc sgpanel data=RCBD; | |
panelby block / rows=2 columns=5; | |
vbox y / category=trt; | |
run; | |
proc sgplot data=RCBD; | |
vbox y / category=block group=trt; | |
run; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment