Hi, I am trying to execute the simple code from Christopher Baum's book, "An Introduction to STATA Programming."
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 repstates, replace
restore
However, it seems that the preserve/restore command is not working, as I get the following message:
nothing to restore
r(622);
I will appreciate any help.
Ahmed
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 repstates, replace
restore
However, it seems that the preserve/restore command is not working, as I get the following message:
nothing to restore
r(622);
I will appreciate any help.
Ahmed
Comment