Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Re: Accumulating variable names to exclude from a varlist
From
Partho Sarkar <[email protected]>
To
[email protected]
Subject
Re: st: Re: Accumulating variable names to exclude from a varlist
Date
Sun, 4 Mar 2012 18:01:47 +0530
Brilliant & elegant! Many thanks, Daniel. As for your question: I
am dealing with data from various sources, and not all the sorting
variables are present in all the files, some of them are named
differently etc.
Partho
On Sun, Mar 4, 2012 at 5:48 PM, daniel klein
<[email protected]> wrote:
> Partho,
>
> I would not use a loop to this. Instead try something like
>
> loc varstolookfor <your variable list here>
> unab allvars : *
> loc varsindata : list allvars & varstolookfor
>
> The local macro "varsindata" will hold all variable names in
> "varstolookfor" that appear in the dataset. However, I do not see why
> you want to sort different datasets by different variables. This
> question is for you to answer of course.
>
> Also see
>
> h unab
> h macro lists
>
> Best
> Daniel
>
*
* 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/