Nikhi wrote:
> Is there a way to get all (_all) except for one of the variables?
To my mind come two easy solutions:
- to use "if" and loop through the levels of your categorical variable:
********************************
sysuse auto, clear
drop make
forvalues i = 0/1 {
preserve
collapse _all if foreign == `i'
save c:\temp\collapse`i', replace
if `i' == 1 {
append using c:\temp\collapse0.dta
save c:\temp\collapse01, replace
}
restore
}
********************************
- or have a look at the command "ds"
type
findit ds
ds saves a varlist in the macro r(varlist) and you can specify a negative
criterium,
e.g.
********************************
sysuse auto, clear
drop make
ds for, not
collapse `r(varlist)', by(foreign)
********************************
regards,
Johannes
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/