Statistical Procedures

Programming the statistical procedures from SAS
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
Lapis Lazuli | Level 10

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

 

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Save $200 when you sign up by March 14!

Register now!

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
  • 286 views
  • 2 likes
  • 3 in conversation