Statalist The Stata Listserver


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

st: =?gb2312?B?tPC4tDogSGFuZGxpbmcgc3RyaW5nIGRhdGE=?=


From   =?gb2312?B?1cW48Q==?= <rereach@sohu.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: =?gb2312?B?tPC4tDogSGFuZGxpbmcgc3RyaW5nIGRhdGE=?=
Date   Thu, 3 Aug 2006 19:48:25 +0800

Mingfeng,
I think the simplest way is to use excel transfer the string x1,x2,x3...
into numbers 0,0,1...and add them to get y.


Greetings!

I have tried to solve this myself with the reference, but no luck so
far.  My problem is to run a function on a string variable.  This is
the data that I have

Variable X:

x1,x2,x3
x1,x3
x2
x1,x3,x4,x5
x5,x6


I was tring to generate a dummy variable y=1 when x3 is contained in X
and 0 otherwise.  Is there a command to do this?

Thanks!

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