Hi, guys, i got trouble about it.
I summarize my variables and want to use matrix to fill in with observation, mean stand Dev, Min, Max and Sharp ratio(which is mean/standard deviation)
First, i make a matrix
command:
matrix A = J(18,6,.)
matrix colnames A="OBS" "MEAN" "SD" "MIN" "MAX" "SHARP"
matrix rownames A="RR_0" "RR_5" "RR_10" "Diff_FS_0" "Diff_FS_3" "Diff_FS_6" "Diff_FS_9" "Diff_FS_12" "Diff_SL_0" "Diff_SL_3" "Diff_SL_6" "Diff_SL_9" "Diff_SL_12" "Coll_R" "Put_R" "Call_R" "Por_P" "Por_ST"
OBS MEAN SD MIN MAX SHARP ( or see potato)
RR_0
RR_5
RR_10
Diff_FS_0
Diff_FS_3
Diff_FS_6
Diff_FS_9
Diff_FS_12
Diff_SL_0
Diff_SL_3
Diff_SL_6
Diff_SL_9
Diff_SL_12
Coll_R
Put_R
Call_R
Por_P
Por_ST
Then i got this matrix. Now, i do not know how to use loop to fill the blank. The left side is my variable. Total is 18 variables. The top has 6 factors including "obs, mean, sd, min, max, sharp ratio"
I try to use loop.
The command:
foreach v of var*{
summarize `v'
return list
matrix A= r(N),r(mean),r(sd),r(min),r(max),r(mean)/r(sd)
}
But it does not work. I think I miss something, i should repeat it until all fill in, right?
I attach a sample which includes 8 variables
anyone can help me?
Thank you
I summarize my variables and want to use matrix to fill in with observation, mean stand Dev, Min, Max and Sharp ratio(which is mean/standard deviation)
First, i make a matrix
command:
matrix A = J(18,6,.)
matrix colnames A="OBS" "MEAN" "SD" "MIN" "MAX" "SHARP"
matrix rownames A="RR_0" "RR_5" "RR_10" "Diff_FS_0" "Diff_FS_3" "Diff_FS_6" "Diff_FS_9" "Diff_FS_12" "Diff_SL_0" "Diff_SL_3" "Diff_SL_6" "Diff_SL_9" "Diff_SL_12" "Coll_R" "Put_R" "Call_R" "Por_P" "Por_ST"
OBS MEAN SD MIN MAX SHARP ( or see potato)
RR_0
RR_5
RR_10
Diff_FS_0
Diff_FS_3
Diff_FS_6
Diff_FS_9
Diff_FS_12
Diff_SL_0
Diff_SL_3
Diff_SL_6
Diff_SL_9
Diff_SL_12
Coll_R
Put_R
Call_R
Por_P
Por_ST
Then i got this matrix. Now, i do not know how to use loop to fill the blank. The left side is my variable. Total is 18 variables. The top has 6 factors including "obs, mean, sd, min, max, sharp ratio"
I try to use loop.
The command:
foreach v of var*{
summarize `v'
return list
matrix A= r(N),r(mean),r(sd),r(min),r(max),r(mean)/r(sd)
}
But it does not work. I think I miss something, i should repeat it until all fill in, right?
I attach a sample which includes 8 variables
anyone can help me?
Thank you
Comment