Hi, I am writing a code for sequential simulation with N=5000, state 1 = N(0,3), state 2 = N(5,10), P(state1)=70%, P(state2)=30%. I wrote a code for this simulation and I also want to show how does this simulation look like. However, in my "showing simulation" part, the result given is 10,000 rather than 5,000. Could anyone provide some hint? Thank you. P.S. Does streaminit (12345) and streaminit(123) make any significant difference? Althogh I can see the results differentiate from different streaminits, I don't quite understand how my result is going to be affected, so any further explanation would be appreciate. Here is my code: /* sample from a mixture distribution */ %let N = 5000; data States(drop=i); call streaminit(12345); array prob [2] _temporary_ (0.7 0.3); do i = 1 to &N; type = rand("Table", of prob[*]); if type=1 then Time = rand("Normal", 0, 3); /* state 1 */ else Time = rand("Normal", 5, 10); /* steta 2 */ output; end; run; proc univariate data=States; ods select Histogram; histogram Time / vscale=proportion kernel(lower=0 c=SJPI); run; /* Showing simulation */ data A(drop=i); call streaminit(123); do i = 1 to 5000; S1 = rand("Normal", 0, 3); output; S2 = rand("Normal", 5, 10); output; end; run; proc print data=A; run;
... View more