Good morning, I am now doing a do_file but I noticed that if I run the whole do file I get different(and wrong) results than if I instead run differently 2 parts divided by a clear all. Anyone knows why?
this are my command:
use "C:\Users\tomma\OneDrive\Desktop\s1_1.dta"
merge m:m hhcode using "C:\Users\tomma\OneDrive\Desktop\S9_1.dta", nogenerate
preserve
drop if age_y<5
drop if educ>14
drop if s9_1q1 !=1
oneway educ s9_1q2, scheffe
restore
merge m:m hhcode using "C:\Users\tomma\OneDrive\Desktop\s2_a.dta", nogenerate
preserve
drop if s2q5 != 2
drop if s9_1q1 != 1
drop if s2q10>14
oneway s2q10 s9_1q2, scheffe
restore
preserve
drop if s2q5 != 1
drop if s9_1q1 != 1
drop if s2q14>14
oneway s2q14 s9_1q2, scheffe
restore
merge m:m hhcode using "C:\Users\tomma\OneDrive\Desktop\s2_B.dta", nogenerate
drop if s2q5 != 1
drop if s9_1q1 != 1
drop if s2q24 >14
oneway s2q24 s9_1q2, scheffe
clear all
use "C:\Users\tomma\OneDrive\Desktop\s1_1.dta"
merge m:m hhcode using "C:\Users\tomma\OneDrive\Desktop\S9_1.dta", nogenerate
drop if age_y<5
drop if s9_1q1 != 1
drop if educ>14
preserve
drop if sex!=1
oneway educ s9_1q2, scheffe
restore
drop if sex != 2
oneway educ s9_1q2, scheffe
clear all
*here is where I divide the 2 parts"
use "C:\Users\tomma\OneDrive\Desktop\s1_1.dta"
merge m:m hhcode using "C:\Users\tomma\OneDrive\Desktop\S9_1.dta", nogenerate
merge m:m hhcode using "C:\Users\tomma\OneDrive\Desktop\S5_1_a.dta", nogenerate
merge m:m hhcode using "C:\Users\tomma\OneDrive\Desktop\S5_1_b.dta", nogenerate
merge m:m hhcode using "C:\Users\tomma\OneDrive\Desktop\s8_1.dta", nogenerate
drop if s9_1q1 !=1
drop if educ>14
gen dummy_participation = 1 if s9_1q2 == 2
replace dummy_participation = 0 if s9_1q2==1
regr educ dummy_participation s5_1q2 s5_1q3
regr educ dummy_participation s5_1q14 s5_1q15
regr educ dummy_participation s8_1q3 s8_1q4
Hope someone can help me. Thanks in advance
Related Posts with Clear all command
IV first stage regressionHi, I was asked to do the first stage (only) in IV regression and then get a table about it. Here ar…
Added value of multivariate regression model (mvreg)Dear forum members, I am using a multivariate model (mvreg) to analyse the effect of many control v…
Replacing values in a variableHello everyone. I am trying to replace the values in an old variable with ones from a new variable.…
Where do I find elemapi.dta ?I'm learning to do regression analysis with Stata following the link here : https://stats.idre.ucla.…
Check whether -moremata- is installedWhen writing .do-files which make use of user written commands, first I check whether these programs…
Subscribe to:
Post Comments (Atom)
0 Response to Clear all command
Post a Comment