Statistical programming, matrix languages, and more

Simulation using SAS

Reply
Occasional Contributor
Posts: 13

Simulation using SAS

I need to simulate multivariate normal data with sas v 9.0 

SAS Super FREQ
Posts: 4,240

Re: Simulation using SAS

Posted in reply to GehadElsayed123

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.  

 

 

Occasional Contributor
Posts: 13

Re: Simulation using SAS

tanks a lot  for your a devices and recommendations  

Occasional Contributor
Posts: 13

Simulation using SAS

Posted in reply to GehadElsayed123

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

SAS Super FREQ
Posts: 4,240

Re: Simulation using SAS

Posted in reply to GehadElsayed123

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.

Occasional Contributor
Posts: 13

Simulation using SAS

[ Edited ]
Posted in reply to GehadElsayed123

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

 

Attachment
Super User
Posts: 23,700

Re: Simulation using SAS

Posted in reply to GehadElsayed123

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


Super User
Posts: 23,700

Re: Simulation using SAS

[ Edited ]
Posted in reply to GehadElsayed123

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...

Occasional Contributor
Posts: 13

Re: Simulation using SAS

Posted in reply to GehadElsayed123

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

 

Occasional Contributor
Posts: 13

Simulation using SAS

Posted in reply to GehadElsayed123

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

 

Ask a Question
Discussion stats
  • 9 replies
  • 205 views
  • 0 likes
  • 3 in conversation