[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: List with strings containing spaces |

Date |
Thu, 19 Jul 2007 15:58:51 +0200 |

--- K Jensen wrote: > Just out of curiosity: how would you take the names of the variables > from the column names of e(B) - in an unspecified order - and generate > a list of selected descriptors *without* using a loop? You can extract the column names from e(b) using -indeplist- and you can use extended macro functions to manipulate the content. In particular with the -subinstr- you can replace ugly names with pretty names which may contain spaces as long as you remember to use compound quotes, see -help extended_fcn- and the example below. However if you want to use these names as column names than you should remember that spaces in column names are not well supported. You can use the underscore instead of a space and when displaying the matrix you can use -matlist- with the -underscore- option. This will replace the underscore with a space in the resulting table. Hope this helps, Maarten *--------- begin example --------------- sysuse cancer, clear stset studytime, failure(died) xi: stcox i.drug age indeplist, local local X : subinstr local X "_Idrug_2" `""drug 2""' local X : subinstr local X "_Idrug_3" `""drug 3""' di `"`X'"' *---------- 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 ) ----------------------------------------- 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/

- Prev by Date:
**st: WinBUGS from Stata** - Next by Date:
**st: Re: svy: mean and descriptive tables** - Previous by thread:
**Re: st: List with strings containing spaces** - Next by thread:
**st: Re: Stata Time Series testparm question** - Index(es):

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