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
Question: How do I test the difference between two diff-in-diff coefficients?Hi Statalist, I want to test whether a normal MA event will have different effect on the outcome fr…
When "append" is more suitable than "merge" for datasets?Hello everyone, I have a question. I have to append/merge a dataset with another one. My question i…
How to create a progressive variable (CEO tenure)Hi everyone, I want to create CEO’s tenure based on “Date become CEO” and “Date left as CEO”. My pr…
MI imputed chained interaction termsHello guys, I am using MICE approach. I have some continuous variables (e.g., income) and categorica…
Replace value in one row based on another variables ID year open near_2 near_3 competition exposed 1 2005 1 1 1 0 0 1 2006 1 1 1 0 1 1 2007 1 1…
Subscribe to:
Post Comments (Atom)
0 Response to second highest value in tabstat
Post a Comment