Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ivqreg.ado can't run command

    Hi,

    I can't run the ivqreg command. This is my first time using a user-written program. I assume that I just paste the .ado file contents into my command window and then I am able to use the command.
    I am using the ivqreg.ado file found on http://faculty.chicagobooth.edu/chri...research/#Code. I downloaded the file on Chrome then copy and pasted the .ado file contents into my command window. There were no problems with running it. Then I used the command:
    ivqreg zhfa2006 cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbmi06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agecare mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206 agedur zoneshock02 zoneshock06 topshock02 topshock06 cshock06mbmi sexcropfail lsshock02 lsshock06 welfshock (bwght_lbs=zhfa)

    and Stata writes: invalid syntax r(197)

    Also, I can't locate the .ado file using Stata's command:
    . viewsource ivqreg.ado
    file "ivqreg.ado" not found

    I've tried the suggestions here: http://www.stata.com/statalist/archi.../msg00808.html but they don't work for me. I found the folder that holds all the stata.ado files and also moved the folder contents from the download to the respective folder. I also tried all of the folder locations.

    I am using Stata/SE 12.1. MacBook Pro OS X, version 10.9.3.

    I tried using the -set trace on- to find the problem with the program but I don't understand the output at all.
    . ivqreg zhfa2006 cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbmi0
    > 6 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agecar
    > e mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206 aged
    > ur zoneshock02 zoneshock06 topshock02 topshock06 cshock06mbmi sexcropfail lsshock02 lsshock06 welfshock
    > (bwght_lbs=zhfa)
    ---------------------------------------------------------------------------------------- begin ivqreg ---
    - version 10.1
    - if _by() {
    local BY `"by `_byvars'`_byrc0':"'
    }
    - if replay() {
    if ("`e(cmd)'"!="myprog") error 301
    Replay `0'
    exit
    }
    - `BY' Estimate `0'
    = Estimate zhfa2006 cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtb
    > mi06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 age
    > care mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206 a
    > gedur zoneshock02 zoneshock06 topshock02 topshock06 cshock06mbmi sexcropfail lsshock02 lsshock06 welfsh
    > ock (bwght_lbs=zhfa)
    ------------------------------------------------------------------------------------ begin Estimate ---
    - local cmdline `"ivqreg `0'"'
    = local cmdline `"ivqreg zhfa2006 cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numan
    > te mtweight mtbmi06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsi
    > ze agemum02 agecare mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 age
    > mon02 dur0206 agedur zoneshock02 zoneshock06 topshock02 topshock06 cshock06mbmi sexcropfail lsshock02 l
    > sshock06 welfshock (bwght_lbs=zhfa)"'
    - gettoken lhs 0 : 0
    - gettoken p 0 : 0, parse(" (") quotes
    - while `"`p'"' != "(" {
    = while `"cshock2002"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"cshockepi06"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"ecozone06"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"ecozone02"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"sex"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"ageorder"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"lngbfed"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"numante"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"mtweight"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"mtbmi06"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"chdborn"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"brchk"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"infkid"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"schkid"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"NagHFF02"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"sectors"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"Nplus"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"lsyear02"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"AGimp06"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"lstockimp06"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"bsize"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"agemum02"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"agecare"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"mumed"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"daded"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"careed"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"cd"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"cd2006"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"sv"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"sv2006"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"hq"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"hq2006"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"access13"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"typesite"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"typesite2006"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"agemon02"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"dur0206"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"agedur"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206 ag
    > edur"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"zoneshock02"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206 ag
    > edur zoneshock02"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"zoneshock06"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206 ag
    > edur zoneshock02 zoneshock06"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"topshock02"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206 ag
    > edur zoneshock02 zoneshock06 topshock02"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"topshock06"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206 ag
    > edur zoneshock02 zoneshock06 topshock02 topshock06"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"cshock06mbmi"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206 ag
    > edur zoneshock02 zoneshock06 topshock02 topshock06 cshock06mbmi"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"sexcropfail"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206 ag
    > edur zoneshock02 zoneshock06 topshock02 topshock06 cshock06mbmi sexcropfail"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"lsshock02"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206 ag
    > edur zoneshock02 zoneshock06 topshock02 topshock06 cshock06mbmi sexcropfail lsshock02"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"lsshock06"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206 ag
    > edur zoneshock02 zoneshock06 topshock02 topshock06 cshock06mbmi sexcropfail lsshock02 lsshock06"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"welfshock"' != "(" {
    - local inexog `"`inexog' `p'"'
    = local inexog `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbm
    > i06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
    > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206 ag
    > edur zoneshock02 zoneshock06 topshock02 topshock06 cshock06mbmi sexcropfail lsshock02 lsshock06 welfsho
    > ck"'
    - gettoken p 0 : 0, parse(" (") quotes
    - }
    - while `"`p'"' != "(" {
    = while `"("' != "(" {
    local inexog `"`inexog' `p'"'
    gettoken p 0 : 0, parse(" (") quotes
    }
    - gettoken q 0 : 0, parse(" =") quotes
    - while `"`q'"' != "=" {
    = while `"bwght_lbs"' != "=" {
    - local endo `"`endo' `q'"'
    = local endo `" bwght_lbs"'
    - gettoken q 0 : 0, parse(" =") quotes
    - }
    - while `"`q'"' != "=" {
    = while `"="' != "=" {
    local endo `"`endo' `q'"'
    gettoken q 0 : 0, parse(" =") quotes
    }
    - gettoken r 0 : 0, parse(" )") quotes
    - while `"`r'"' != ")" {
    = while `"zhfa"' != ")" {
    - local instr `"`instr' `r'"'
    = local instr `" zhfa"'
    - gettoken r 0 : 0, parse(" )") quotes
    - }
    - while `"`r'"' != ")" {
    = while `")"' != ")" {
    local instr `"`instr' `r'"'
    gettoken r 0 : 0, parse(" )") quotes
    }
    - local allinstr `"`inexog' `instr'"'
    = local allinstr `" cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mt
    > bmi06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 ag
    > ecare mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206
    > agedur zoneshock02 zoneshock06 topshock02 topshock06 cshock06mbmi sexcropfail lsshock02 lsshock06 welfs
    > hock zhfa"'
    - local rhs `"`endo' `inexog'"'
    = local rhs `" bwght_lbs cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtwei
    > ght mtbmi06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemu
    > m02 agecare mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 du
    > r0206 agedur zoneshock02 zoneshock06 topshock02 topshock06 cshock06mbmi sexcropfail lsshock02 lsshock06
    > welfshock"'
    - local options "Level(cilevel)"
    - syntax [if] [in] [, ///
    invalid syntax
    -------------------------------------------------------------------------------------- end Estimate ---
    ------------------------------------------------------------------------------------------ end ivqreg ---
    r(197);



    Thank you.
    Last edited by Le T. Quach; 14 Jul 2014, 00:03. Reason: quantile regression, endogenous variables, instrumental variables, ivreg, ivqreg

  • #2
    Welcome to Statalist. As you guessed, you're handling user-written commands incorrectly. You need to 'install' them -- meaning getting all the relevant files, and storing them in the right directories. For packages that are on SSC, this is easy: you simply type ssc install <packagename> and it's all done automatically. More generally, after doing a search or findit for packages, you'll typically have clickable links to follow that do the installation in an analogous manner. So, (1) you need to install ivqreg correctly. (2) Thank you for stating the provenance of the user-written command (as asked by the forum FAQ). This is really important in your case because search does not give any hits for ivreg! All the files should be downloaded to either PERSONAL (type sysdir to see what directory that is), or the relevant subdirectory of PLUS (ditto). (3) again from the FAQ. please look at how to use the advanced editor when you are composing posts as you did: long amounts of code output should be enclosed in appropriate CODE delimiters so that it is legible.
    Last edited by Stephen Jenkins; 14 Jul 2014, 01:23.

    Comment


    • #3
      Hi Stephen,
      After the file is in the folder (see picture) a.i. where sysdir directs for PLUS, what exactly do I do to be able to use the command? When I insert the command program ivqreg, Stata writes:
      Code:
      ivqreg already defined
      r(110);
      Now, when I command viewsource ivqreg.ado, Stata identifies where I put the file and pulls up the Viewer to show the .ado program code for ivqreg (see picture). Is that what happens when a correctly (and manually) downloaded .ado file do when it is in the right location for this command?

      I've tried running the .ado and then exiting Stata, thinking that maybe it needs to me to restart to use a manually downloaded program. This doesn't work. I still get the error

      ivqreg zhfa2006 cshock2002 cshockepi06 ecozone06 ecozone02 sex ageorder lngbfed numante mtweight mtbmi
      > 06 chdborn brchk infkid schkid NagHFF02 sectors Nplus lsyear02 AGimp06 lstockimp06 bsize agemum02 agec
      > are mumed daded careed cd cd2006 sv sv2006 hq hq2006 access13 typesite typesite2006 agemon02 dur0206 a
      > gedur zoneshock02 zoneshock06 topshock02 topshock06 cshock06mbmi sexcropfail lsshock02 lsshock06 welfs
      > hock(bwght_lbs=zhfa)

      Code:
      invalid syntax
      r(197);

      My apologies for the novice question. I already have installed several packages through the Stata options (ssc, findit...) and have no problems using those packages.

      Thank you for your response.
      Last edited by Le T. Quach; 14 Jul 2014, 04:13.

      Comment


      • #4
        In haste: Q1: check that you don't have multiple instances of ivqreg installed now. Use which ivqreg to check you're getting expected behaviour, and delete/reinstall as necessary. Q2 (syntax error): there looks to be something wrong at the very end of your command line (NB better to put this in the delimited code as well). Do you need an additional space before the weighting statement? Have you got the weighting statement correct? Check the syntax diagram for ivqreg shown its help file (I'm assuming there is one!), or by looking at the ado file as you did using viewsource. Good luck.
        PS note that error 197 in full means the following:
        Code:
        [P]     error . . . . . . . . . . . . . . . . . . . . . . . .  Return code 197
                invalid syntax;
                This error is produced by syntax and other parsing commands when
                there is a syntax error in the use of the command itself rather
                than in what is being parsed.
        Maybe you haven't installed all the required files from the URL you mentioned? Experiment more with set trace on too to try and track where the problem is.

        Comment

        Working...
        X