st: RE: Dummy Variable From a String

You don't give a definition of the dummy variable
you want. But
tab myvar, gen(myvar)
will generate a set of dummies regardless of
whether -myvar- is string or numeric.
And if -myvar- is string,
gen is4c = myvar == "4c"
is 1 or 0 depending on whether the equality on the RHS
is true or false. And so on.
Not only do you not want to -destring-, -destring-
could at best map some of your values to missing,
so it is hard to see how it could be any use even
for any other purpose.
Nick
n.j.cox@durham.ac.uk
Michael.D.Wilson@frb.gov
> I need to create a dummy variable from a string variable that
> contains
> both numbers and letters. The string variable is a number sometimes
> followed by the letter 'c'. For example:
>
> 1
> 2
> 3
> 4c
> 5c
> 6c
>
> I need to create a dummy variable from this variable without
> destringing
> it. Any ideas?
*
* 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/