I have 6 binary variables and want to export to Excel two tables showing the distribution in frequency (number of 1's) and percent (percent of 1's), i.e., the results of
and
. I have set the command directory to my working folder. Then I try to do:
And get the error code: "an expression is required for command tabm because it is an nclass command within option command()"
Maybe this is because -table- only works on base Stata commands? I know I could do
for each of my six variables, but then I would get 6 different tables. Maybe a forval-loop and then some sort of command combining the tables would do the trick. Can anyone help here? My data looks something like this:
Code:
tabm s2_*
Code:
tabm s2_*, row nofreq
Code:
putexcel set figurer, replace table, command(tabm s2_*)
Maybe this is because -table- only works on base Stata commands? I know I could do
Code:
table () (s2_1)
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte(s2_1 s2_2 s2_3 s2_4 s2_5 s2_6) 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 end
Comment