s***r 发帖数: 1121 | 1 Here is the original database
FirmID Year earnings Mean Variance
BBB 2004 E1 x1 std1
BBB 2005 E2 x2 std2
BBB 2006 E3 x3 std3
BBB 2007 E4 x4 std4
BBB 2008 E5 x5 std5
I want to randomly generate 50 numbers, normally distributed, with the mean/
variance as defined.
I want to create a new database like this:
FirmID Year earnings Mean Variance sim_num1 sim_num2.. sim_num50
BBB 2004 |
g*********e 发帖数: 458 | 2 我不是牛人,初学者,不知道能不能解决你的问题:我的想法是先写个小loop生成符合
规定的随机量,然后用macro来反复调用这个小loop生成许多你要的mean and var。然
后合并这些out里的mean and var。
mean/
【在 s***r 的大作中提到】![](/moin_static193/solenoid/img/up.png) : Here is the original database : FirmID Year earnings Mean Variance : BBB 2004 E1 x1 std1 : BBB 2005 E2 x2 std2 : BBB 2006 E3 x3 std3 : BBB 2007 E4 x4 std4 : BBB 2008 E5 x5 std5 : I want to randomly generate 50 numbers, normally distributed, with the mean/ : variance as defined. : I want to create a new database like this:
|
l*********s 发帖数: 5409 | 3 you want to draw a sample with defined mean and variance? that is strange. |
g**a 发帖数: 2129 | 4 data one;
input FirmID $ Year earnings $ Mean Variance ;
datalines;
BBB 2004 E1 100 8
BBB 2005 E2 300 10
BBB 2006 E3 600 12
BBB 2007 E4 530 30
BBB 2008 E5 410 28
;
run;
proc IML;
use one;
read all;
xmean=mean;
xvar=variance;
xyear=year;
Numrow=Nrow(xmean);
do y=1 to Numrow;
sim=rand('NORMAL', mean[y], sqrt(variance[y]));
do x=2 to 250 by 1;
sim=sim||rand('NORMAL', mean[y], sqrt(variance[y])); |
s***r 发帖数: 1121 | 5 您转给 gaea,现金(伪币):25,收取手续费:0.25
同时附加了如下留言给 gaea.
Da Niu - Many thanks for yor help! |
D*A 发帖数: 811 | 6 大牛,学习
【在 g**a 的大作中提到】![](/moin_static193/solenoid/img/up.png) : data one; : input FirmID $ Year earnings $ Mean Variance ; : datalines; : BBB 2004 E1 100 8 : BBB 2005 E2 300 10 : BBB 2006 E3 600 12 : BBB 2007 E4 530 30 : BBB 2008 E5 410 28 : ; : run;
|
h*********y 发帖数: 1080 | |