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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: How to deal with commands that are too long for e(cmdline) when writting postestimation commands?


From   Maarten Buis <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to deal with commands that are too long for e(cmdline) when writting postestimation commands?
Date   Thu, 2 Aug 2012 17:43:07 +0200

The trick is not evaluate the contents of e(cmd), so store the command
in a local macro like this

local cmd `e(cmd)'

and _not_ like this:

local cmd = `e(cmd)'

After that you can use the extended macro functions to manipulate it.
These are documented in -help extended_fcn- (I usually forget, even
though I use it a lot. I typically type -help macro- and click on the
link to extended macro functions). If you use the string functions
instead of extended macro functions you will evaluate the string, and
the 244 character limit will bite again.

In order to get the variables used in the model I tend to prefer to
use column names of the vector of coefficients.

Hope this helps,
Maarten

On Thu, Aug 2, 2012 at 5:18 PM, Schmidt Alexander
<alexander.schmidt@wiso.uni-koeln.de> wrote:
> Dear Statalisters,
>
> I am working on an ado that calculates influence statistics
> for higher-level clusters after hierarchical mixed models.
> However, my question is pretty much independent of my ado.
> My postestimation command needs to extract a list of all
> independent variables of the model and also some other
> elements from the command (options, random effects specifications etc.).
>
> Everything works fine and I don't have a problem with the syntax.
> My problem is simply that I don't know how to deal with command
> lines that exceed 244 characters. How do you deal with command lines
> that cannot be stored in e(cmdline)? Is there a way to get all the
> variables, options, etc. even if the command exceeds 244 characters?
>
> Thanks,
>
> Alex
>
>
>
>
>
>
>
>
>
> *
> *   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/
*
*   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