The following code is used to generate 50 vectors of size n and each vector is variable (E) having normal distribution with mean 0 and variance equals 1, so how can I generate this variable 50 times but when the variable (E) follows normal distribution with mean 0 and variance equals 4 ?
You can use the RANDGEN call, which includes optional arguments for the mean and Std Dev. You first need to allocate a vector to store the data:
E = j(n,1);
do i = 1 to 50;
call randgen(E, "Normal", 0, 4);
You can also get all 50 variables at once. Each column of the following matrix contains a sample from N(0, 4).