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: RE: Irritating if...else question for mata vs. stata


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: Irritating if...else question for mata vs. stata
Date   Mon, 7 Jun 2010 09:59:59 +0100

Sorry, but I can't see why the first version doesn't work while the
second does. 

Nick 
[email protected] 

Thomas Jacobs

Back again.  Here is the type of behavior that led me to write in the
first place.  I have a do file calling another do to generate a Latex
table.  The latter do is part mata to aggregate variable values and
then switches back to stata for the table generation portion.  Here is
how the final part of the mata code appears utilizing the belief that
mata if blocks need not be followed by empty else blocks and the error
it generates:

: if (FirstCDXDay > 0) {
>
>         CDXAdjSizePowVRight = vec(CountCDXAdjSizePowRight')
>         CDXMktSizePowVRight = vec(CountCDXMktSizePowRight')
>         CDXAdjSizePowVLeft = vec(CountCDXAdjSizePowLeft')
>         CDXMktSizePowVLeft = vec(CountCDXMktSizePowLeft')
>
> }
>
> end

unexpected end of line
(117 lines skipped)

Now, I add back the heretofore extraneous else block and the program
continues on to successful completion:

: if (FirstCDXDay > 0) {
>
>         CDXAdjSizePowVRight = vec(CountCDXAdjSizePowRight')
>         CDXMktSizePowVRight = vec(CountCDXMktSizePowRight')
>         CDXAdjSizePowVLeft = vec(CountCDXAdjSizePowLeft')
>         CDXMktSizePowVLeft = vec(CountCDXMktSizePowLeft')
>
> }
> else{
> }

:
: end
------------------------------------------------------------------------
----------------------

.
. if ${BootstrapSwitch} file open tex using
table_SizePow_${ObsLength}Obs_${EventLength}DayEv_
>
${Ret}Diffs_${MCtrials}MCtrials_${Bootstraps}Bootstraps${Grade}Indexes.t
ex, write replace

....
remainder of program cut off for readability.


Any suggestions for what I may be missing or how I might better
understand what is going on here?  The programs are long so I don't
wish to post them, but certainly there must be some explanation for
such behavior.  It has happened to me before and I make a habit of
posting empty else blocks all over the place and thus, led me to the
mata manual with its ambiguous definitions and finally to post here.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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