- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 01-17-2025 02:32 PM
(285 views)
Hi everybody,
I am trying to simulate Poisson data but not sure if I am doing it correctly.
I know that in a given population, an event occurs at a rate of 1.2 per year.
If I would like to simulate 1000 set of data each containing 50 patients, is this how the code should be written?
Thanks!
data Poisson;
call streaminit(4321);
lambda = 0.8;
do SimID = 1 to 1000;
do i = 1 to 50;
x = rand("Poisson", lambda);
output;
end;
end;
run;
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I think you want to set lambda to 1.2 in your case:
data test;
do i=1 to 10000;
x=rand('poisson',1.2);
output;
end;
run;
proc univariate data=test noprint;
histogram x / midpoints=0 to 7 by 1;
inset mean median max / position=NE;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content