ch2.1.do open
file:script:do
| # | content |
|---|---|
| 2 [+] | adopath |
| 4 [+] | display %21x 1/10 |
| 6 [+] | sysuse auto , |
| 7 [+] | generate lprice = log(price) |
| 8 [+] | preserve |
| 9 [+] | collapse (max) max_lprice=lprice max_mpg=mpg /// (iqr) iqr_lprice=lprice iqr_mpg=mpg if !missing(rep78), by(rep78) |
| 11 [+] | sort rep78 |
| 12 [+] | save repstats , |
| 14 [+] | restore |
| 15 [+] | sort rep78 |
| 16 [+] | merge rep78 using repstats , |
| 17 [+] | summarize lprice max_lprice iqr_lprice |
adopath display %21x 1/10 sysuse auto, clear generate lprice = log(price) preserve collapse (max) max_lprice=lprice max_mpg=mpg /// (iqr) iqr_lprice=lprice iqr_mpg=mpg if !missing(rep78), by(rep78) sort rep78 save repstats, replace restore sort rep78 merge rep78 using repstats, uniqusing summarize lprice max_lprice iqr_lprice