Statalist The Stata Listserver


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

RE: st: Suggestion regarding lookfor


From   "Grealy, Patrick J" <[email protected]>
To   <[email protected]>
Subject   RE: st: Suggestion regarding lookfor
Date   Fri, 26 Jan 2007 13:55:49 -0600

Hi,
This -lookfor- is a nice piece of work that I had no idea existed; not
that I purport to know every other Stata command.

My to-do list has long included a command like -lookfor- but with the
capacity to loop through a series of datasets, either explicitly
specified or just all the .dta files in a given folder. Does such a
program already exist?

It seems that if the -describe using filename- option could be adapted
to provide -lookfor using filename- then I would merely have to work up
a sort of wrapper program to accomplish my goal. Has anyone done this
already?

Thanks,
Pat Grealy

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Alan Riley
Sent: Thursday, January 25, 2007 12:01 PM
To: [email protected]
Subject: Re: st: Suggestion regarding lookfor

Sergio Correia ([email protected]) asked about making
-lookfor- respect phrases when searching:
> Since I learned about -lookfor- a short time ago, I've found it
> incredibly useful specially for searching inside variable
> descriptions. However, when trying to match a string with more than
> one word, -lookfor- does something slightly undesirable.
> 
> When I enter -lookfor gdp inflation-, I expect -lookfor- to find
> matches containing gdp or inflation. That, the command does fine.
> 
> However, if i write
> lookfor "Gross Domestic Product"
> I expect the program to match exactly that phrase (either in lowercase
> or uppercase). Instead, I get all variables containing gross, domestic
> or product.

This is something we (StataCorp) should change.  Expect to see this
in a future ado-file update.

Technical note: Sergio suggested

   Change line 12 from
		local looklist `"`looklist' `w'"'
   To
		local looklist `"`looklist' "`w'""'

That is what we will do, but we will use compound double quotes `" "'
around `w' in case the phrase in `w' has embedded double quotes:

		local looklist `"`looklist' `"`w'"'"'



Alan
([email protected])
*
*   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/



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