Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Sam Asin <asin.sam@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Running a model using global macro statement |
Date | Tue, 3 Sep 2013 10:45:22 -0400 |
Hello, this is my first post here! I am trying to create a do file that runs a logit command. I use a global macro statement to set up the regression, it's called $regressionstatement. global regressionstatement "$regtype" "$dependentvar" " " "collection2" " " "$zipind" " " "$dateind" " " "$kenparam" "$ifstatement" ", " "$options" At the bottom of my code, it invokes $regressionstatement. However, I get this error: 2" " invalid name r(198); However, if I write: display "$regressionstatement" and then copy paste the output onto my command line and run it, it works. I also tried: "$regressionstatement" to no avail, as well as: global test "$regressionstatement" $test How can I make my code run the regressoin statement that I've made without requiring the additional manual input? For what it's worth, I've included the code of interest below. global regressionstatement "$regtype" "$dependentvar" " " "collection2" " " "$zipind" " " "$dateind" " " "$kenparam" "$ifstatement" ", " "$options" display "$regressionstatement" logit event90 collection2 i.zipspecial i.date dage1-dage8 cohort96 cohort97 cohort98 cohort99 cohort00 cohort01 cohort02 cohort03 cohort04 cohort05 cohort06 cohort0 > 7 cohort08 ltv1 ltv2 ltv3 ltv4 ltv5 fico1 fico2 fico3 fico4 xfc11 xfc12 xfc13 xfc14 xfc21 xfc22 xfc23 xfc24 xfc31 xfc32 xfc33 xfc34 xfc41 xfc42 xfc43 xfc44 oupb1- > oupb4 fdti1 fdti2 fdti3 fdti4 bdti1 bdti2 bdti3 bdti4 sato1-sato2 second_lien metro units condo if def_obs_count<2, vce(robust) . $regressionstatement 2" " invalid name logit event90 collection2 i.zipspecial i.date dage1-dage8 cohort96 cohort97 cohort98 cohort99 cohort00 cohort01 cohort02 cohort03 cohort04 cohort05 cohort06 cohor > t07 cohort08 ltv1 ltv2 ltv3 ltv4 ltv5 fico1 fico2 fico3 fico4 xfc11 xfc12 xfc13 xfc14 xfc21 xfc22 xfc23 xfc24 xfc31 xfc32 xfc33 xfc34 xfc41 xfc42 xfc43 xfc44 oupb > 1-oupb4 fdti1 fdti2 fdti3 fdti4 bdti1 bdti2 bdti3 bdti4 sato1-sato2 second_lien metro units condo if def_obs_count<2, vce(robust) note: 33890.zipspecial != 0 predicts success perfectly 33890.zipspecial dropped and 60 obs not used etc. Thanks! Sam * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/