I think you want
gen pain=1 if index(code,"4")>0
4 being whatever you want to identify
----- Original Message -----
From: "Raphael Fraser" <[email protected]>
To: <[email protected]>
Sent: Thursday, February 23, 2006 11:41 AM
Subject: st: String Problem
> I have the following string variable code and would like to create the
> variable pain. Code is a combination of two digit codes (1 letter,1
> number) lumped together as many 6 codes can be combined.
>
> code pain
> Z1D4 1
> Y1 0
> H4T2D4F7 1
> D4D5 1
>
> I am not sure what combination of string functions to use. Can anyone
help?
>
> *
> * 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/