BookmarkSubscribeRSS Feed
CHELS
Obsidian | Level 7

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
quickbluefish
Barite | Level 11

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;

quickbluefish_0-1737148505113.png

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 444 views
  • 2 likes
  • 3 in conversation