Dear All,
I have been using findname, which is truly excellent bit of code.
However, i was attempting to search for text within a value label, and then hoping it would tell me what value of the value label it was found at.
Thinking that it shouldn't be to difficult to add in a bit of code,i had a go, with some success (surprisingly!).
I amended the following code at line 220. specifically the addition of vvlablist and its accumulation within the if `found' subsection.
and prior to the termination of the end of the program
I am sure the is a much prettier way of displaying the results, but i have no idea how to get things nicely lined up in columns.
I hope someone might find this useful, and i apologize for sullying Nick Cox's code.
I have been using findname, which is truly excellent bit of code.
However, i was attempting to search for text within a value label, and then hoping it would tell me what value of the value label it was found at.
Thinking that it shouldn't be to difficult to add in a bit of code,i had a go, with some success (surprisingly!).
I amended the following code at line 220. specifically the addition of vvlablist and its accumulation within the if `found' subsection.
Code:
qui if `"`vallabeltext'"' != "" { local vlist local vvlablist foreach v of local varlist { local lbl : val label `v' if "`lbl'" != "" { levelsof `v' `if', local(levels) foreach l of local levels { local txt : label `lbl' `l', strict mata : find_match(`"`txt'"', `"`vallabeltext'"', `inse', "`found'") if `found' { local vlist `vlist' `v' local vvlablist `" `vvlablist' "`v' `l' `txt'" _n"' continue, break } } } } local varlist `vlist' }
and prior to the termination of the end of the program
Code:
if `"`vallabeltext'"' != "" { di `vvlablist' }
I hope someone might find this useful, and i apologize for sullying Nick Cox's code.
Comment