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
Time dummies in SYS-GMM modelHi, I estimated SYS-GMM model with time dummies for different periods (like 2006-2008, 2009-2015, 2…
rangestat from SSC in combination with percentile functionConcerning rangestat from SSC Hi, I am looking for a way to combine rangestat with a percentile fu…
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…
Can strL be disabled? It is breaking all my pre-16 code.The strL data type is clearly useful, but the fact that it can't be used for a merge is breaking bac…
adding a zero in the middle of a string variableDear Statalist users, I have a string variable(patient id) in the form ED6/01/001 ED6/01/002 ED6/01…
Subscribe to:
Post Comments (Atom)
0 Response to second highest value in tabstat
Post a Comment