Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

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 n.j.cox@durham.ac.uk 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/

**References**:**st: Irritating if...else question for mata vs. stata***From:*Thomas Jacobs <thomasjacobs@gmail.com>

**st: RE: Irritating if...else question for mata vs. stata***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: RE: Irritating if...else question for mata vs. stata***From:*Thomas Jacobs <thomasjacobs@gmail.com>

**Re: st: RE: Irritating if...else question for mata vs. stata***From:*Thomas Jacobs <thomasjacobs@gmail.com>

- Prev by Date:
**RE: st: Poisson regression -not concave-** - Next by Date:
**Re: st: mediation in constant coefficients panel regression** - Previous by thread:
**Re: st: RE: Irritating if...else question for mata vs. stata** - Next by thread:
**st: xi3 with char varname[omit] #** - Index(es):