When running the following snippet of code in a do file:
. use uganda13.dta
.
. /*Let's start with some cleaning of parcel manager variables*/
.
. gen double m0 = parcel_manager0
. gen double m1 = parcel_manager1
. gen double m2 = parcel_manager2
.
. tostring m0, replace format(%20.0f)
m0 was double now str1
. tostring m1, replace format(%20.0f)
m1 was double now str1
. tostring m2, replace format(%20.0f)
m2 was double now str1
.
. gen temp1 = cond(m1 < m2, m1, m2)
. gen temp2 = cond(m1 < m2, m2, m1)
. /*Jake: let's see if this fixes the problem*/
. bysort year season HHID: gen temp1 = cond(m1 < m2, m1, m2)
. bysort year season HHID: gen temp2 = cond(m1 < m2, m2, m1)
. replace temp2 = "." if temp1 == temp2 & temp2! = "." /*Jake: not called in this case, throwing error*/
(0 real changes made)
.
. replace m1 = temp1
(0 real changes made)
. replace m2 = temp2
(0 real changes made)
.
. drop temp1 temp2
.
. replace m0 = m1 if m1!="." & m2=="." & m0=="."
(0 real changes made)
. replace m1="." if m0!="."
(0 real changes made)
.
. *bysort season HHID parcelID plotID cropID: gen N = _N
.
. /*We now look at crops per plot*/
. egen count4 = nvals(cropID) if cropID != ., by(season HHID parcelID plotID)
I get the error:
__000001 not found
r(111);
end of do-file
After reading a bit about what the issue might be, it seems this error gets thrown when a problem with a temporary variable or file is occurring... As a relative novice to Stata, might anyone have some guidance as to how to resolve this error? Could it possibly be a problem with the way I'm using egen?
. use uganda13.dta
.
. /*Let's start with some cleaning of parcel manager variables*/
.
. gen double m0 = parcel_manager0
. gen double m1 = parcel_manager1
. gen double m2 = parcel_manager2
.
. tostring m0, replace format(%20.0f)
m0 was double now str1
. tostring m1, replace format(%20.0f)
m1 was double now str1
. tostring m2, replace format(%20.0f)
m2 was double now str1
.
. gen temp1 = cond(m1 < m2, m1, m2)
. gen temp2 = cond(m1 < m2, m2, m1)
. /*Jake: let's see if this fixes the problem*/
. bysort year season HHID: gen temp1 = cond(m1 < m2, m1, m2)
. bysort year season HHID: gen temp2 = cond(m1 < m2, m2, m1)
. replace temp2 = "." if temp1 == temp2 & temp2! = "." /*Jake: not called in this case, throwing error*/
(0 real changes made)
.
. replace m1 = temp1
(0 real changes made)
. replace m2 = temp2
(0 real changes made)
.
. drop temp1 temp2
.
. replace m0 = m1 if m1!="." & m2=="." & m0=="."
(0 real changes made)
. replace m1="." if m0!="."
(0 real changes made)
.
. *bysort season HHID parcelID plotID cropID: gen N = _N
.
. /*We now look at crops per plot*/
. egen count4 = nvals(cropID) if cropID != ., by(season HHID parcelID plotID)
I get the error:
__000001 not found
r(111);
end of do-file
After reading a bit about what the issue might be, it seems this error gets thrown when a problem with a temporary variable or file is occurring... As a relative novice to Stata, might anyone have some guidance as to how to resolve this error? Could it possibly be a problem with the way I'm using egen?
Comment