This is a question about creating the desired output table using tabstat.
I create quartiles, and then compute the means and medians of two variables Va and Vb.
This is the code:
xtile returns_quartile= Stock_return_2022,n(4)
by returns_quartile : asdoc tabstat Va Vb , replace stat(mean median) format(%9.2fc) columns(variables)
This produces a Table with the statistics of Va and Vb in each quartile, in rows. This should not be the case as the option- columns(variables) - should create a table with Vb and Vb in columns. I believe that the code should also add a thousands comma separator, but it does not. Also, I would like to know how to write the medians in parenthesis, Please, see in the attached file what I get and what I would like to get. I would appreciate your help.
I create quartiles, and then compute the means and medians of two variables Va and Vb.
This is the code:
xtile returns_quartile= Stock_return_2022,n(4)
by returns_quartile : asdoc tabstat Va Vb , replace stat(mean median) format(%9.2fc) columns(variables)
This produces a Table with the statistics of Va and Vb in each quartile, in rows. This should not be the case as the option- columns(variables) - should create a table with Vb and Vb in columns. I believe that the code should also add a thousands comma separator, but it does not. Also, I would like to know how to write the medians in parenthesis, Please, see in the attached file what I get and what I would like to get. I would appreciate your help.
Comment