Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: searching the notes


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: searching the notes
Date   Tue, 3 Aug 2004 19:55:17 +0100

This would seem approachable 
as a variation on various programs
posted on 11 May, e.g. 

*! NJC 1.0.0 3 Aug 2004
program searchnotes
	version 8 
	syntax name(name=what) 
	
	local nnotes "`: char _dta[note0]'" 
	if "`nnotes'" != "" { 
		forval i = 1/`nnotes' { 
			local char : char _dta[note`i'] 
			local WHAT : ///
		subinstr local char `"`what'"' `"`what'"', count(local n)
			if `n' {
				di as res "_dta: " as txt `"`char'"' 
			}
		}	
	} 

	foreach v of var * { 
		local nnotes "`: char `v'[note0]'" 
		if "`nnotes'" != "" { 
			forval i = 1/`nnotes' { 
				local char : char `v'[note`i'] 
				local WHAT : ///
		subinstr local char `"`what'"' `"`what'"', count(local n)
				if `n' {
					di as res "`v': " as txt `"`char'"' 
				}
			} 
		} 
	} 
end 

I'd appreciate a more elegant method of counting... 
 
Nick 
n.j.cox@durham.ac.uk 

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of 
> Roger Harbord
> Sent: 03 August 2004 19:29
> To: Statalist; tech-support@stata.com
> Subject: st: searching the notes
> 
> 
> Is there any way of searching all the -notes- for a given 
> string?  I find 
> -lookfor- very useful when dealing with datasets with many 
> variables but it 
> would be even more useful if it had a -, notes- option to 
> allow searching of 
> the notes attached to the variables too. Alternatively maybe 
> if -notes list- 
> had a -, find(string)- option..?
> 
> I realise that you need to have a lot of notes in your 
> dataset to find this 
> useful - we do here as our database manager has set up a 
> clever system (don't 
> ask me how it works) to export from Access to Stata so each 
> Field Description 
> in Access becomes a note attached to that variable in Stata. 
> (The Field 
> Descriptions are too long to make useful variable labels and 
> often exceed the 
> limit of 80 characters for variable labels.)
> 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index