Hi,
I am simulating multiple datsets (and concatinating them using the proc append within the macro) using the same seed in the call streaminit but my answers are different. Could anyone suggest a solution
Are they any reasons why my answers my not be reproduced that I am unaware?
Data param;
pr_male=0.7;
pr_all=0.3;
run;
%macro sim (SSB1=, SSB2=, FFV1=, FFV2=,interv=);
Data have&interv ;
set param;
call streaminit(354);
interv=&interv;
do env=1 to 3;
all=rand('bernoulli', pr_all);
do id=1 to 100;
Male = rand('bernoulli', pr_male);
do t=1 to 2;
if t=1 then do;
SSB1 = &SSB1;
FFV1 = &FFV1;
end;
else if t=2 then do;
SSB2 = &SSB2;
FFV2 = &FFV2;
end;
output;
end;
end;
end;
run;
%mend sim;
%sim(SSB1=1, SSB2=0, FFV1=1, FFV2=0,interv=0);
%sim(SSB1=0, SSB2=1, FFV1=0, FFV2=0, interv=1);
thank you
Try it again. Make sure there are no errors or warnings in the log. My own test generates two identical streams for pseudo random variables all and Male.
Try it again. Make sure there are no errors or warnings in the log. My own test generates two identical streams for pseudo random variables all and Male.
@PGStats would you get the same streams if run on different system? I assume this is true but can't test at the moment.
Using streaminit is supposed to guarantee deterministic sequences, at least on a given system (hardware/version). But I wouldn't assume it does across systems.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.