BookmarkSubscribeRSS Feed
GehadElsayed123
Calcite | Level 5

I need to simulate multivariate normal data with sas v 9.0 

9 REPLIES 9
Rick_SAS
SAS Super FREQ

I regret that I do not know which functions are available in SAS V9.0, which was released in 2002. There have been 12 releases of SAS software since then.  Check your documentation to see if the RANDNORMAL function is available. If not, check whether the VNORMAL call is implemented.  If neither exists, use PROC SIMNORMAL in SAS/STAT software.  

 

 

GehadElsayed123
Calcite | Level 5

tanks a lot  for your a devices and recommendations  

GehadElsayed123
Calcite | Level 5

Are there differences between  simulating multivariate data and simulating multivariate control charts ?

Rick_SAS
SAS Super FREQ

They are related. Control charts monitor any stationary process. The control limits for the familiar chart are based on normal errors (variation). Many familiar control charts are univariate, which means that they do not consider correlations between several variables. There are control charts for multivariate processes, but these are not as popular.

 

You can simulate multivariate data from many distributions. If you simulate from a multivariate normal distribution, then the data satisfies the assumptions behind many control charts.

GehadElsayed123
Calcite | Level 5

I do this code and find this error , i use SAS V9.0

 

Reeza
Super User

You're likely not using SAS 9.0

 

Run the following and post the version of IML and SAS that you're using.

proc product_status;run;

It's also helpful if you include the code and log directly in your post rather than as an attachment, as below.

 

50   proc iml;
NOTE: IML Ready
51   meu={0 0 0};
52   cov={1 0 0,
53        0 1 0,
54        0 0 1};
55        N=1;
56        NumSample=100;
57
58
59       call vnormal(meu,cov,N);
ERROR: Cannot process data matrix. Data should be a vector.
ERROR: Execution error as noted previously. (rc=100)

 operation : VNORMAL at line 59 column 5
 operands  : cov, N

cov      3 rows      3 cols    (numeric)

         1         0         0
         0         1         0
         0         0         1

N      1 row       1 col     (numeric)

         1

 statement : CALL at line 59 column 5
60
61   run;
NOTE: Module MAIN is undefined in IML; cannot be RUN.
61 !     quit;
NOTE: Exiting IML.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IML used (Total process time):
      real time           0.37 seconds
      cpu time            0.03 seconds


Reeza
Super User

From the most recent documentation:

 

VNORMAL Call

CALL VNORMAL (series, mu, sigma, n <, seed> );

The VNORMAL subroutine generates a multivariate normal random series.

This function is deprecated. Instead, you should use the RANDNORMAL function to generate random values. The RANDNORMAL function calls the RANDGEN subroutine, which has excellent statistical properties. Consequently, the RANDNORMAL function is preferred when you need to generate millions of random numbers.

 

 

However, this works for me. Note the first parameter is not MU, it's the output series. 

 

proc iml;
meu={0 0 0};
cov={1 0 0,
     0 1 0,
	 0 0 1};
	 N=1;
	 NumSample=100;


	call vnormal(out, meu,cov,N);
    print(out);

But you should switch to the  newer versions.

 

Link to documentation:

http://documentation.sas.com/?docsetId=imlug&docsetVersion=14.3&docsetTarget=imlug_langref_sect531.h...

GehadElsayed123
Calcite | Level 5

i need to know how  can  simulate multivariate control charts with SAS v 9.00 

 

GehadElsayed123
Calcite | Level 5

i need to know how  can  simulate multivariate control charts with SAS v 9.00 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Multiple Linear Regression in SAS

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.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 9 replies
  • 1605 views
  • 0 likes
  • 3 in conversation