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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Re: referring to groups of variables by suffixes


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: referring to groups of variables by suffixes
Date   Wed, 28 Nov 2012 13:01:04 +0000

Yes. See -help varlist- for so-called wildcards. They work with suffixes too,

. sysuse auto
(1978 Automobile Data)

. ds
make          rep78         weight        displacement
price         headroom      length        gear_ratio
mpg           trunk         turn          foreign

. ds *t
weight        displacement


Nick

On Wed, Nov 28, 2012 at 12:48 PM, Michael Stewart
<michaelstewartresearch@gmail.com> wrote:

> I am working with a large dataset (approx 600 variables) with
> different names but some of them end in similar manner
>
> Eg:
> procedure__11_procedure_code___i
> procedure__11_procedure_date
> procedure__11_procedure_or_ind
> procedure__11_procedure_tissue_t
> procedure__11_procedure_type
> procedure__12_procedure_abnormal
> procedure__12_procedure_code_icd
> procedure__12_procedure_date
> procedure__12_procedure_ep_no
> procedure__12_procedure_location
> procedure__12_procedure_or_ind
> procedure__12_procedure_physicia
> procedure__12_procedure_tissue_t
> procedure__12_procedure_type
> procedure__12_procedure_type0
> procedure__13_procedure_abnormal
> procedure__13_procedure_anes_age
> procedure__13_procedure_anes_met
> procedure__13_procedure_code_icd
> procedure__13_procedure_date
>
> I want to drop variables ending with procedure_tissue_t and
> procedure_anes_age. Its tedious to do it for large number of
> variables.Can you please suggest a shortcut . Is there  a shortcut to
> refer to all variables ending with procedure_tissue_t &
> procedure_anes_age.I found shortcuts to refer to variables for
> prefixes  but not for suffixes so far.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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