Bookmark and Share

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]

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


From   Fred Wolfe <fwolfe@arthritis-research.org>
To   statalist@hsphsun2.harvard.edu
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)
r(612);


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'"
end

Thanks.


Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
NDB Office +1 316 263 2125 Ext 0
Research Office +1 316 686 9195
fwolfe@arthritis-research.org
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index