Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: Program error after installing Stata 12.1 for the MAC.

From   Fred Wolfe <>
Subject   st: Program error after installing Stata 12.1 for the MAC.
Date   Wed, 1 Feb 2012 13:47:47 -0600

I colleague just reported to me that a program I wrote suddenly
stopped working after he upgraded to 12.1 for the MAC. He reported the
following error:

. splitglobmac nsaid
unexpected end of file
(error occurred while loading splitglobmac.ado)

I told him I had no problem running the program on 12.0. Then I
upgraded to 12.1 and got the same error.

On Stata 11 (since I no longer have 12.0) it produces the following
correct output:

. splitglobmac nsaid

Splitting global macro nsaid of 36 words and 245 characters at 18
words into two local submacros:
split to nsaid_1 = aceclofen ansaid arthrotc asatyl asprin clinoril
daypro diflunisal dipirona ecasa etofenam feldene ibuprof
> n indocin ketoprof lodine lornoxicam magsalate
split to nsaid_2 = meclomen melox nabumetn nalfon naprosyn nsaidns
proglumet salsalat tenoxcam tolmetin vimovo voltaren arcox
> ia bextra celebrex niflumic prexige vioxx

However, when we resave the program after adding extra final carriage
returns, the program works again.

It appears as if the 12.1 upgrade is not reading the final carriage
return correctly. As this may happen in other programs, a fix is
needed urgently.

The program code is copied below.

*! splitglobmac v 1.0.1 31may08 fw splits a global macro into 2 local
submacros suffixed as macname_1 & macname_2
*! keywords: macro split
program define splitglobmac, rclass
	version 10.0
	syntax anything
   local macname $`anything'
	local macsize: word count `macname'
   local maclength = length("`macname'")
   local splitnum = floor(`macsize'/2)
   di _n as text "Splitting global macro " as result `"`anything'"' as
text " of `macsize' words and `maclength' characters at `splitnum'
words into two local submacros:"
   local i = 0
   foreach word of local macname {
   local `i++'
   if `i' <=`splitnum' local _x1 `_x1' `word'
   if `i' >`splitnum' local  _x2 `_x2'   `word'
   local `anything'_1 `_x1'
   local `anything'_2 `_x2'
   return local `anything'_1 `_x1'
   return local `anything'_2 `_x2'
   di as result "split to `anything'_1 = ``anything'_1'"
   di as result "split to `anything'_2 = ``anything'_2'"


Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
NDB Office +1 316 263 2125 Ext 0
Research Office +1 316 686 9195
*   For searches and help try:

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