Possibly not the issue, but don't use
local varlist1 = " < long list> "
when you are just copying from right to left. You
are likely to get bugs, because lists will be truncated
at 80 characters. See help on -limits-: see limits
of length of string expression
Nick
[email protected]
Maoyong Fan
> I wrote a very simple program and run it on both Stata 7
> intercool and Stata 8 SE, but they give me different answers.
>
> The reason is that they drop different variables.
>
> I wonder why is this. Should they do the same job since I
> use the exact same program and data set?
>
> Program:
>
> clear
>
> set memory 200m
> ***set maxvar 2048
> set more off
> set rmsg on
>
> set logtype text
> set linesize 200
>
> ***Course 32 matching estimator
>
> use pdp_matching.dta, clear
> keep coalition_pool verbal_sat math_sat eop_status hs_gpa
> father_educ mother_educ language_code english non_english
> ethnic admit_major math_physics econ_business
> chemistry biology engineering c32_lecture
> c32_times_taken c32_year c32_term
> c32_num_grade c32_math_98 c32_pdp_ids
> c32_pdp_ids_not_pass c32_slc_adjunct
> c32_slc_adjunct_not_pass pdp slc
> pdp_coalition_pool
>
> drop if coalition_pool == .
> drop if verbal_sat == .
> drop if math_sat == .
> drop if eop_status == .
> drop if hs_gpa == .
> drop if father_educ == .
> drop if mother_educ == .
> drop if language_code == .
> drop if english == .
> drop if non_english == .
> drop if ethnic == .
> drop if ethnic == 9
> drop if admit_major == .
> drop if math_physics == .
> drop if econ_business == .
> drop if chemistry == .
> drop if biology == .
> drop if engineering == .
> drop if c32_lecture == .
> drop if c32_year == .
> drop if c32_term == .
> drop if c32_num_grade == .
>
> drop if slc == 1
>
> keep if ethnic == 1
>
>
> keep if c32_num_grade < 5 | c32_num_grade==6 | c32_num_grade==7
> replace c32_num_grade=0 if c32_num_grade<=1.3 | c32_num_grade==7
> replace c32_num_grade=1 if c32_num_grade>=1.7 | c32_num_grade==6
>
> generate same_class = c32_year*100 + c32_term*10 + c32_lecture
>
> local varlist_1 = "math_sat eop_status hs_gpa
> father_educ mother_educ english non_english
> math_physics econ_business chemistry biology engineering"
> local varlist_2 = "verbal_sat"
>
> foreach var of local varlist_1 {
> egen `var'_max = max(`var')
> egen `var'_min = min(`var')
> if `var'_max ~= `var'_min {
>
> local varlist_2 = "`varlist_2' `var'"
> di "keep `var'"
> }
> else {
> display "drop `var'"
>
> }
> }
> display "Finish dropping"
>
>
> egen pdp_sum = sum(pdp)
>
> describe
>
> }
>
> log close
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/