Hi,

I am trying to use "moments2" and use the skewness, kurtosis, and SD as my data.
The following is the example of my data (it is just a small part of my complete data). My full data has 24(IDs)*20(years)*12(months)*30(Days)

----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float edate byte mnth int yr str5 id double rate
15706 1 2003 "A"        .
15707 1 2003 "A" 1.776182
15708 1 2003 "A" 1.774442
15709 1 2003 "A"        .
15710 1 2003 "A"        .
15711 1 2003 "A"  1.74304
15712 1 2003 "A" 1.741966
15713 1 2003 "A" 1.747326
15714 1 2003 "A" 1.729514
15715 1 2003 "A" 1.723984
15716 1 2003 "A"        .
15717 1 2003 "A"        .
15718 1 2003 "A" 1.716656
15719 1 2003 "A" 1.712678
15720 1 2003 "A" 1.712331
15721 1 2003 "A" 1.706551
15722 1 2003 "A"  1.69095
15723 1 2003 "A"        .
15724 1 2003 "A"        .
15725 1 2003 "A" 1.694922
15726 1 2003 "A" 1.702244
15727 1 2003 "A" 1.704889
15728 1 2003 "A" 1.690992
15729 1 2003 "A" 1.690931
15730 1 2003 "A"        .
15731 1 2003 "A"        .
15732 1 2003 "A" 1.687029
15733 1 2003 "A" 1.699389
15734 1 2003 "A" 1.692584
15735 1 2003 "A" 1.701247
15736 1 2003 "A" 1.700906
15737 2 2003 "A"        .
15738 2 2003 "A"        .
15739 2 2003 "A" 1.715444
15740 2 2003 "A" 1.696636
15741 2 2003 "A" 1.688818
15742 2 2003 "A" 1.693517
15743 2 2003 "A" 1.694411
15744 2 2003 "A"        .
15745 2 2003 "A"        .
15746 2 2003 "A" 1.686714
15747 2 2003 "A" 1.698113
15748 2 2003 "A" 1.689498
15749 2 2003 "A" 1.693252
15750 2 2003 "A" 1.684981
15751 2 2003 "A"        .
15752 2 2003 "A"        .
15753 2 2003 "A" 1.696342
15754 2 2003 "A" 1.693112
15755 2 2003 "A" 1.687039
15756 2 2003 "A" 1.677878
15757 2 2003 "A" 1.668297
15758 2 2003 "A"        .
15759 2 2003 "A"        .
15760 2 2003 "A" 1.661226
15761 2 2003 "A" 1.651105
15762 2 2003 "A" 1.651353
15763 2 2003 "A" 1.644982
15764 2 2003 "A" 1.652384
15706 1 2003 "B"        .
15707 1 2003 "B"  7.11009
15708 1 2003 "B" 7.148095
15709 1 2003 "B"        .
15710 1 2003 "B"        .
15711 1 2003 "B" 7.082285
15712 1 2003 "B" 7.125659
15713 1 2003 "B" 7.159198
15714 1 2003 "B" 7.071191
15715 1 2003 "B" 7.073217
15716 1 2003 "B"        .
15717 1 2003 "B"        .
15718 1 2003 "B" 7.042848
15719 1 2003 "B" 7.024203
15720 1 2003 "B" 7.059662
15721 1 2003 "B" 7.035498
15722 1 2003 "B" 6.979253
15723 1 2003 "B"        .
15724 1 2003 "B"        .
15725 1 2003 "B" 6.977377
15726 1 2003 "B" 6.977659
15727 1 2003 "B" 6.937955
15728 1 2003 "B" 6.913173
15729 1 2003 "B" 6.897533
15730 1 2003 "B"        .
15731 1 2003 "B"        .
15732 1 2003 "B" 6.841766
15733 1 2003 "B" 6.881199
15734 1 2003 "B" 6.840817
15735 1 2003 "B" 6.917008
15736 1 2003 "B"  6.87574
15737 2 2003 "B"        .
15738 2 2003 "B"        .
15739 2 2003 "B" 6.932333
15740 2 2003 "B" 6.870911
15741 2 2003 "B"  6.81549
15742 2 2003 "B"  6.87441
15743 2 2003 "B" 6.887571
15744 2 2003 "B"        .
15745 2 2003 "B"        .
15746 2 2003 "B" 6.876665
end
format %d edate
------------------ copy up to and including the previous line ------------------


To find skewness by id, mnth, and yr, I used the following command: "bys id mnth yr: moments2 rate"

-> id = A, mnth = 1, yr = 2003
----------------------------------------------------------
n = 22 | mean SD skewness kurtosis
----------+-----------------------------------------------
exchrate | 1.715 0.026 1.155 0.519
----------------------------------------------------------
-> id = A, mnth = 2, yr = 2003
----------------------------------------------------------
n = 20 | mean SD skewness kurtosis
----------+-----------------------------------------------
exchrate | 1.681 0.020 -0.591 -0.621
----------------------------------------------------------
-> id = B, mnth = 1, yr = 2003
---------------------------------------------------------
n = 22 | mean SD skewness kurtosis
----------+-----------------------------------------------
exchrate | 6.999 0.100 -0.057 -1.214
----------------------------------------------------------
-> id = B, mnth = 2, yr = 2003
----------------------------------------------------------
n = 20 | mean SD skewness kurtosis
----------+-----------------------------------------------
exchrate | 6.899 0.033 -0.652 0.260
----------------------------------------------------------

What I want to do is to use the skewness as data. I would like to create a data set like the following:


edate mnth yr id rate skewness SD kurtosis
.
.
15712 1 2003 "A" 1.741966 1.155 0.026 0.519
15713 1 2003 "A" 1.747326 1.155 0.026 0.519
.
.
15740 2 2003 "A" 1.696636 -0.591 0.020 -0.621
15741 2 2003 "A" 1.688818 -0.591 0.020 -0.621
.
.
15707 1 2003 "B" 7.110090 -0.057 0.100 -1.214
15708 1 2003 "B" 7.148095 -0.057 0.100 -1.214
.
.
15739 2 2003 "B" 6.932333 -0.652 0.033 0.260
15740 2 2003 "B" 6.870911 -0.652 0.033 0.260

Is there any way I can do it in more efficient way?
I always appreciate your help and time.