BookmarkSubscribeRSS Feed
HM3
Calcite | Level 5 HM3
Calcite | Level 5

How to generate random var in a matrix (20*30) form having mean=3 and standard dev=1.

Thanks

Parth

1 REPLY 1
Rick_SAS
SAS Super FREQ

You don't specify the distribution, but I assume you want normally distributed values from N(3,1)? Here is a PROC IML solution:

proc iml;

x = j(20, 30);  /* allocate 20x30 matrix */

call randseed(123); /* seed random seed */

call randgen(x, "Normal", 3, 1); /* N(3,1) */

For more about generating random samples, see http://blogs.sas.com/content/iml/2010/09/22/efficient-sampling/

If you one day want a sample from a multivariate normal distribution, see http://blogs.sas.com/content/iml/2011/01/12/sampling-from-the-multivariate-normal-distribution/

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1 reply
  • 1552 views
  • 0 likes
  • 2 in conversation