Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Running a model using global macro statement


From   Federico Belotti <[email protected]>
To   [email protected]
Subject   Re: st: Running a model using global macro statement
Date   Tue, 3 Sep 2013 16:56:03 +0200

assuming that "collection2" is a global, try using

...
global creation
...
 
global regressionstatement "$regtype $dependentvar $collection2 $zipind $dateind $kenparam $ifstatement, $options"
$regressionstatement

On Sep 3, 2013, at 4:45 PM, Sam Asin wrote:

> 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/

-- 
Federico Belotti, PhD
Research Fellow
Centre for Economics and International Studies
University of Rome Tor Vergata
tel/fax: +39 06 7259 5627
e-mail: [email protected]
web: http://www.econometrics.it


*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index