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: Searching for files with a particular *value* of a variable


From   Partho Sarkar <partho.ss+lists@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Searching for files with a particular *value* of a variable
Date   Thu, 1 Mar 2012 13:53:58 +0530

Many thanks, Nick!  This will get me started.

Partho

On Thu, Mar 1, 2012 at 1:23 PM, Nick Cox <njcoxstata@gmail.com> wrote:
> You can approach this in various ways. I haven't used either of the
> user-written programs you mentioned but let's just approach it from
> first principles:
>
> local present
> quietly foreach f in <filelist> {
>            use `f'
>            count if <varname> == <value>
>            if r(N) local present `present' `f''
> }
>
> di `present'
>
> You'd need something subtle if your filenames contain spaces.
>
> Nick
>

*
*   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/


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