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: matrix colnames manipulation


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: matrix colnames manipulation
Date   Wed, 4 Jul 2012 10:24:32 +0100

In the same spirit -- but assuming each name is different --

local nnames : word count `longmacro'
local last : word `nnames' of `longmacro'
local longmacro : subinstr local longmacro "`last'" "<whatever>"

Nick

On Wed, Jul 4, 2012 at 10:20 AM, Maarten Buis <[email protected]> wrote:
> On Wed, Jul 4, 2012 at 11:06 AM,  <[email protected]> wrote:
>> I want to use estimates derived using -xtprobit- as starting values for
>> estimation using -gllamm, family(binomial) link(probit)
>> from(mat_start)-. (-gllamm- is on SSC.)  To use the "from" option, I
>> want to manipulate the full column names of the e(b) matrix produced by
>> -xtprobit-. The issue is that -gllamm- labels the column corresponding
>> to the variance of the random effect differently to -xtprobit-. So,
>> specifically, how, within a long list of colnames stored with a macro,
>> does one change the final name?
>
> What about the following solution:
>
> *---------------------- begin example ------------------------
> local coln `"bu_SA:Lfemale bu_SA:Ledq_low lnsig2u:_cons"'
> local coln : subinstr local coln "lnsig2u:_cons" "pid1:_cons"
> di "`coln'"
> *----------------------- end example -------------------------
> (For more on examples I sent to the Statalist see:
>  http://www.maartenbuis.nl/example_faq )
>
*
*   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