Hi everyone,
I'm trying to produce a table with the number of observations that each of 30 variables has for each month and for a period of about 360 months. I'm able to produce the table with tabstat (with a minor issue that I'll explain later) but Stata brakes the results into several sub-tables has it can't show the results in one single table in the output window. My idea is to save the results to an excel file, but can't figure it out how to do it.
I've been using:
tabstat x1-x30, by(datem) col(variables) stat(n)
I've tried using the collapse and the putexcel solutions used here, but they do not seem to work. The collapse solution seems to work fine for a limited number of variables. For the number of variables I need it takes a bit of time to write the command and if I need to change the variables I need to rewrite everything again. The putexcel solution does not seem to work with the by option.
The final issue is that, when producing the table instead of showing the datem as 2000m1, 2000m2, etc, the internal number is shown, I've tried to create a string variable but it is based on Stata internal number for month...
I just need to get a table like this:
datem x1 x2 x3 ....
2000m1 n_x1 n_x2 n_x3
2000m2 n_x1 n_x2 n_x3
any ideas on how to solve this?
Thanks!
I'm trying to produce a table with the number of observations that each of 30 variables has for each month and for a period of about 360 months. I'm able to produce the table with tabstat (with a minor issue that I'll explain later) but Stata brakes the results into several sub-tables has it can't show the results in one single table in the output window. My idea is to save the results to an excel file, but can't figure it out how to do it.
I've been using:
tabstat x1-x30, by(datem) col(variables) stat(n)
I've tried using the collapse and the putexcel solutions used here, but they do not seem to work. The collapse solution seems to work fine for a limited number of variables. For the number of variables I need it takes a bit of time to write the command and if I need to change the variables I need to rewrite everything again. The putexcel solution does not seem to work with the by option.
The final issue is that, when producing the table instead of showing the datem as 2000m1, 2000m2, etc, the internal number is shown, I've tried to create a string variable but it is based on Stata internal number for month...
I just need to get a table like this:
datem x1 x2 x3 ....
2000m1 n_x1 n_x2 n_x3
2000m2 n_x1 n_x2 n_x3
any ideas on how to solve this?
Thanks!

Comment