Hi there! I'm having some trouble working with summary statistics and conditional logic. Below is the code I have written so far.
What I would like to do is generate a list of variables (not observations) with an interquartile range of less than 2, a mean greater than or equal to 3, and a median greater than or equal to 3. What would be the best way of doing this? Does it involve the egen command?
Thank you for any/all suggestions!
Code:
sysuse auto, clear foreach var of varlist price mpg rep78 headroom trunk weight length turn displacement gear_ratio { tabstat `var', by(`var') statistics(n mean sd q iqr) tabulate `var', sort }
Thank you for any/all suggestions!
Comment