Hi I have used SAS to generate 3 different distributions
1. N~ (0,1) with variable X1.....X20
2. N~ (5,1) with variable Y1.....Y20
3. B(0.5) "bernoulli" with variable U1......U20
Now I want to create a new distribution Q where
Q { X, if U = 0 and Y, if U =1
How would I do this? Would I create a new dataset with all 3 variables?
Thanks for any help!
Probably, or merge existing data sets.
When you say X, if U = 0 and Y, if U =1 do you mean if U=0 and U=Y or something else? Be very explicit. Also there appears to be something missing after "If U=1 …"
I would keep it simple and create a new dataset with all four variables:
data want;
call streaminit(27182818);
do _n_=1 to 20;
x=rand('norm'); /* X ~ N(0,1) */
y=rand('norm',5); /* Y ~ N(5,1) */
u=rand('bern',0.5); /* U ~ Bin(1,0.5) */
q=ifn(u,y,x); /* normal mixture */
output;
end;
run;
Or is there something special about your existing "distribution datasets" that you don't want to discard them?
2025 SAS Hackathon: There is still time!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!