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

From |
"Maarten Buis" <M.Buis@fsw.vu.nl> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: RE: Generating grouped variable list of xi'd variables via column names |

Date |
Fri, 13 Jul 2007 15:13:36 +0200 |

I just realized that -c_local- isn't documented, so you can't find out what it does (though you can probably guess by reading the code). -c_local- is explained in this post: http://www.stata.com/statalist/archive/2005-11/msg00405.html (I think Nick should stay away from the stash of mushrooms he collected in the 70s) Hope this helps, Maarten ----------------------------------------- Maarten L. Buis Department of Social Research Methodology Vrije Universiteit Amsterdam Boelelaan 1081 1081 HV Amsterdam The Netherlands visiting address: Buitenveldertselaan 3 (Metropolitan), room Z434 +31 20 5986715 http://home.fsw.vu.nl/m.buis/ ----------------------------------------- -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Maarten Buis Sent: vrijdag 13 juli 2007 14:54 To: statalist@hsphsun2.harvard.edu Subject: RE: st: RE: Generating grouped variable list of xi'd variables via column names --- K Jensen wrote: > I was wondering how easy it would be to convert the results in > model_I > di "`model_I'" > _Idrug_2 _Idrug_3 _Irandcat_2 _Irandcat_3 > to the form _Idrug* _Irandcat* A slightly messy solution is shown below. As you are probably using this repeatedly in your do-file it might be useful to create a program at the beginning of your do-file that does this (call it -ab_i-), so in the remainder of your do-file you can refer to -ab_I- whenever you want to do this. This way your do-file will look cleaner and easier to understand (and debug). *------------- begin example ------------- capture program drop ab_I program define ab_I *!version 1.0.0 MLB 13 July 2007 /*get list of all _I vars*/ qui indeplist, local unab all_I : _I* local model_I : list all_I & X /*abbreviate _I vars*/ local min_I : subinstr local model_I "_I" "", all foreach stub of local min_I { gettoken temp : stub, parse("_") local ab "`ab' _I`temp'*" } local ab : list uniq ab c_local ab "`ab'" end sysuse cancer, clear stset studytime, fail(died) gen randcat= ceil(3*uniform()) xi:stcox i.drug age i.randcat ab_I di "`ab'" *--------------- end example ------------- (For more on how to use examples I sent to the Statalist, see http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html ) Hope this helps, Maarten ----------------------------------------- Maarten L. Buis Department of Social Research Methodology Vrije Universiteit Amsterdam Boelelaan 1081 1081 HV Amsterdam The Netherlands visiting address: Buitenveldertselaan 3 (Metropolitan), room Z434 +31 20 5986715 http://home.fsw.vu.nl/m.buis/ ----------------------------------------- * * 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/ * * 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/

- Prev by Date:
**Re: st: RE: Generating grouped variable list of xi'd variables via column names** - Next by Date:
**st: RE: selecting random samples and run a simulation** - Previous by thread:
**Re: st: RE: Generating grouped variable list of xi'd variables via column names** - Next by thread:
**st: RE: selecting random samples and run a simulation** - Index(es):

© Copyright 1996–2014 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |