Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Parsing variable list into dependent and independent variables (logit)


From   "Peterson, Leif" <[email protected]>
To   <[email protected]>
Subject   st: Parsing variable list into dependent and independent variables (logit)
Date   Tue, 1 Apr 2008 12:10:44 -0500

I am trying to run the mylogit.ado program (below) to parse a variable
list and run logit regression.  However, there is an exception being
thrown at run-time which is called "+ invalid name."  

Example usage is:

mylogit bloodpress age sexfem


----------------------------------

program define mylogit,eclass
  version 10
  syntax [varlist] 
  local ncol:word count `varlist'
  local depvar:word 1 of `varlist'
  forv i=2(1)`ncol' {
  local indepvar:word `i' of `varlist'
  local indepvars `indepvars' + "`indepvar'"
  }
  logit `depvar' `indepvars'
end


Leif Peterson


NOTICE:  Our e-mail address at Methodist has changed to tmhs.org


Methodist. Leading Medicine. 

Ranked No. 10 on FORTUNE magazine's list of the "100 Best Companies to Work For" in 2008
Named by U.S. News & World Report as one of "America's Best Hospitals"
Designated as a Magnet hospital for excellence in nursing

***CONFIDENTIALITY NOTICE***
This e-mail is the property of The Methodist Hospital and/or its relevant affiliates and may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender and delete all copies of the message. Thank you.



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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index