I am trying to generate a random number from a mixture normal distribution but got an error message that the matrices do not conform to the operation. Here is my code:
proc iml;
call randseed(12345);
p = {0.2 0.5 0.3}; mu = {0 5 10}; sig = {1 1 2};
call randgen(x, 'NORMALMIX',p,mu,sig);
print x;
quit;
The NORMALIMIX family was added in SAS/IML 12.1, which shipped with SAS 9.3m2.
To find your version of SAS, look at the top of the SAS Log when you start SAS, or following the instructions in this article: Determine the version of SAS software at run time - The DO Loop
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Register now!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.