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

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

From   "Feiveson, Alan H. (JSC-SK311)" <>
To   <>
Subject   st: RE: Parsing variable list into dependent and independent variables (logit)
Date   Wed, 2 Apr 2008 08:07:59 -0500

Leif - Try the syntax below:

Note you should also initialize
local indepvars ""

before the loop. If you're working with strings, it's usually better to
not use "=" signs.

local indepvars "`indepvars' `indepvar'"


-----Original Message-----
[] On Behalf Of Peterson,
Sent: Tuesday, April 01, 2008 12:11 PM
Subject: st: Parsing variable list into dependent and independent
variables (logit)

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'

Leif Peterson

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

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

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

*   For searches and help try:

*   For searches and help try:

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