hi
i need your help to simulate two different sample from multivariate dichotomous variables by using sas/iml and the program below for 1 sample how can i circulate for two samples.
thanks in advance
%include "C:\Users\hp\Desktop\RandMVBinary.sas";
proc iml;
load module=_all_; /* load the modules */
p = {0.25 0.75 0.5 0.25 0.30 0.10 0.30 0.55 0.25 0.65}; /* expected values of the X
Delta = {1 0.15 0.2 0.175 0.15 0.125 0.1 0.075 0.05 0.025,
0.15 1 0.225 0.15 0.175 0.075 0.125 0.1 0.075 0.05 ,
0.2 0.225 1 0.225 0.2 0.15 0.15 0.125 0.1 0.075,
0.175 0.15 0.225 1 0.225 0.2 0.175 0.15 0.125 0.1 ,
0.15 0.175 0.2 0.225 1 0.225 0.2 0.175 0.15 0.125,
0.125 0.075 0.15 0.2 0.225 1 0.225 0.125 0.175 0.1 ,
0.1 0.125 0.15 0.175 0.2 0.225 1 0.225 0.2 0.175,
0.075 0.1 0.125 0.15 0.175 0.125 0.225 1 0.225 0.2 ,
0.05 0.075 0.1 0.125 0.15 0.175 0.2 0.225 1 0.2 ,
0.025 0.05 0.075 0.1 0.125 0.1 0.175 0.2 0.2 1 };
X = RandMVBinary(1000, p, Delta);
/* compare sample estimates to parameters */
print p, Delta;
create MVbinary from X; append from X; close MVB;
quit;
Y = RandMVBinary(1000, p, Delta);
thanks alot dr. rick
please where can i put this y = RandMVBinary(1000, p, Delta); because i have x = RandMVBinary(1000, p, Delta); in my program , and after putting this command y = RandMVBinary(1000, p, Delta); the program will be
%include "C:\Users\hp\Desktop\RandMVBinary.sas";
proc iml;
load module=_all_; /* load the modules */
p = {0.25 0.75 0.5 0.25 0.30 0.10 0.30 0.55 0.25 0.65}; /* expected values of the X
Delta = {1 0.15 0.2 0.175 0.15 0.125 0.1 0.075 0.05 0.025,
0.15 1 0.225 0.15 0.175 0.075 0.125 0.1 0.075 0.05 ,
0.2 0.225 1 0.225 0.2 0.15 0.15 0.125 0.1 0.075,
0.175 0.15 0.225 1 0.225 0.2 0.175 0.15 0.125 0.1 ,
0.15 0.175 0.2 0.225 1 0.225 0.2 0.175 0.15 0.125,
0.125 0.075 0.15 0.2 0.225 1 0.225 0.125 0.175 0.1 ,
0.1 0.125 0.15 0.175 0.2 0.225 1 0.225 0.2 0.175,
0.075 0.1 0.125 0.15 0.175 0.125 0.225 1 0.225 0.2 ,
0.05 0.075 0.1 0.125 0.15 0.175 0.2 0.225 1 0.2 ,
0.025 0.05 0.075 0.1 0.125 0.1 0.175 0.2 0.2 1 };
X = RandMVBinary(1000, p, Delta);
y = RandMVBinary(1000, p, Delta);
/* compare sample estimates to parameters */
print p, Delta;
create MVbinary from X; append from X; close MVB;
quit;
i get on just one sample i want 2 samples, you mean i must repeat the program one to x and another to y?
thanks in advance
THANOON
i think i must repeat the program one time for x and another time for y too get on different samples.
thanks alot dr. rick
You don't need two programs. Assign Y after you have assigned X within the same program.
thank you so much i want to apply same method on mvordinal with two samples but i got on same results for X AND Y.how can i solve this problem.
many thanks
thanks alot dr.rick i solve it . i want to ask you when i applied same equation X and Y in mvordinal i got on same results why?
many thanks
You should not get the same answer if you compute both in a single PROC IML program.
If you run the same program twice, you will get the same answer because the random number seed is the same.
So I must change the random number seed for the second program.
Thanks alot
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.