Hi,
i need to export many summary tables to excel. In these summary tables I need to have the highest and second highest value of a variable grouped by another variable.
For example:
sysuse auto
tabstat price, statistics(mean sd p25 p50 p75 p90 count max min) by(foreign)
Unfortunately, there is no "statistic" in the tabstat option to specify that I need not only the max but also the second highest value.
I know that there are ados like "extremes" but I really need summary statistics (mean, sd, quantiles and the two highest values) in one table (because I need to export >100 tables in total).
Do you have any ideas how I can get a table such as with tabstat and the by option plus the two highest values?
Thanks a lot in advance!
Related Posts with second highest value in tabstat
psgraphI'm using the psgraph command to generate a propensity score histogram with the binary treatment var…
Questions about asdoc with option keepHello, everyone! I am using asdoc to report some nested regression tables to Word. For the sake of …
How to drop observations missing an '@' markI'm trying to merge two datasets using the email addresses. There are a number of observations in t…
pscoreIs the command pscore present in Stata 16? …
Problems in obtaining the right hand side confidence interval of a regressionHi there, I calculated the abnormal returns of german federal state bonds as well as I plotted them…
Subscribe to:
Post Comments (Atom)
0 Response to second highest value in tabstat
Post a Comment