As a simple example (not my use case), we know that the return list differs between the following two commands. The first has 7 scalars, the second has 19 scalars. I'd like to either: (i) collect all the names in a local or global string, (ii) have them assigned as row/column names in a matrix, or (iii) save their values in a .dta file with variables assigned their names.
Command 1:
Code:
sysuse auto * qui: sum mpg return list scalars: r(N) = 74 r(sum_w) = 74 r(mean) = 21.2972972972973 r(Var) = 33.47204738985561 r(sd) = 5.785503209735141 r(min) = 12 r(max) = 41 r(sum) = 1576
Code:
qui: sum mpg, detail return list scalars: r(N) = 74 r(sum_w) = 74 r(mean) = 21.2972972972973 r(Var) = 33.47204738985561 r(sd) = 5.785503209735141 r(skewness) = .9487175964588155 r(kurtosis) = 3.97500459645325 r(sum) = 1576 r(min) = 12 r(max) = 41 r(p1) = 12 r(p5) = 14 r(p10) = 14 r(p25) = 18 r(p50) = 20 r(p75) = 25 r(p90) = 29 r(p95) = 34 r(p99) = 41
0 Response to How do we use -- e.g. loop over, or save -- all the scalar names in a command's return list without knowing the names in advance?
Post a Comment