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/

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1643 views
  • 0 likes
  • 2 in conversation