Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Help with varlist manipulation


From   "K Jensen" <k.x.jensen@googlemail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Help with varlist manipulation
Date   Mon, 20 Nov 2006 16:30:37 +0000

Nick Cox wrote:
I have three comments:

1. You need to tell us your criterion of "categorical".
Sorry, I should have made myself clear.  I am writing an ado file that
may be run using xi.  A categorical variable is therefore anything
which has been passed to my program after being "xi"'d.

2. Your processing is better down upstream than downstream.

3. I don't understand your terminology of string members.
Sorry, I am new to Stata as a programming language.

So, in essence, the algorithm should look like

foreach v of var <varlist> {
 if <`v' is categorical> {
  local V `"`V' "`v' (categorical)""'
 }
 else local V `"`V' "`v'""'
}

and you should apply this before calling -xi:-.
Thanks for this, but for my needs it would be a lot more useful if the
processing could be done downstream of xi, so that the command was
"xi"-able.  Is that impossible?

Thanks again
Karin
PS) Kit Baum: thanks for your suggestion, but I am not using
"estimate" to output the results (am grabbing and manipulating ereturn
elements and sticking them in  a matrix which I then list) and I
wasn't trying to do this for the results table anyway!

Nick
n.j.cox@durham.ac.uk

K Jensen
I am writing an ado file to help with some modelling I'm doing.
One of the input arguments is a varlist of the independent
variables.

I am trying to produce additional "friendly" output to describe
the model, particularly for variables produced using "xi" from
categorical data. It is only me using it--so I know that I won't
be making dummy variables differently--but other people will be
looking at the output.

Using the auto data as an example say my varlist was:
mpg _Irep78_2 _Irep78_3 _Irep78_4 _Irep78_5 length (method
always involves a constant)

I would like to dereference the varlist to become just a list
with string members and from it produce the list: "mpg" "rep78
(categorical)" "length"

I have tried looping through the varlist and trying various
string functions on it but am getting nowhere.
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index