Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Windows 7 search inside do-file

From   Dan Blanchette <>
Subject   Re: st: Windows 7 search inside do-file
Date   Fri, 9 Dec 2011 10:13:42 -0500 (EST)

The user-written Stata command -find- can be made to search
subdirectories by using the command I co-authored called -rcd-
(recursively change directories):

 . ssc install find
 . ssc install rcd
 . rcd "C:\data"  : find *.do , match(some word or phrase) show

So, the above code will search the directory "C:\data" and all
the subdirectories of "C:\data".

Windows 7 can somewhat find a word or set of words in a do-file.
You need to have the ".do" file types added to the list of file types listed in Indexing Options (under Control Panel). When you click on "Indexing Options" you then need to click on the Advanced button. This requires administrator permission...which hopefully you have the ability to do things on your computer with administrator
permissions.  Then click on the tab "File Types" and scroll down
for "do" (add that file type if it is not there).  Then select "do"
and make sure "Index Properties and File Contents" is selected...
which is not the default.

Then in the Windows Explorer window you can type in the search box:

 contents: "something" *.do

If you type more than one word inside the double quotes, then
Windows 7 considers that a list of words to search for not a
specific phrase.  There is no option to do a case sensitive search.
And, by default the setting for searches is to search for partial matches not whole words.

Hope this helps,
Dan Blanchette

Research Programming Services
Carolina Population Center
University of North Carolina
Chapel Hill, NC 27516 USA

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index