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

Re: st: Converting string variable name into numbers


From   Rafal Raciborski <[email protected]>
To   [email protected]
Subject   Re: st: Converting string variable name into numbers
Date   Fri, 13 May 2005 12:26:03 -0400

Just add a -gen- option after -tab-:

. list Language

     +----------+
     | Language |
     |----------|
  1. |  English |
  2. |  English |
  3. |  Spanish |
  4. |  Spanish |
  5. |  Spanish |
     |----------|
  6. |   French |
  7. |  English |
  8. |   French |
     +----------+

. tab Language, gen(language_dummy)

   Language |      Freq.     Percent        Cum.
------------+-----------------------------------
    English |          3       37.50       37.50
     French |          2       25.00       62.50
    Spanish |          3       37.50      100.00
------------+-----------------------------------
      Total |          8      100.00

. slist

     Language  language_dummy1  language_dummy2  language_dummy3
  1.  English                1                0                0
  2.  English                1                0                0
  3.  Spanish                0                0                1
  4.  Spanish                0                0                1
  5.  Spanish                0                0                1
  6.   French                0                1                0
  7.  English                1                0                0
  8.   French                0                1                0

.

rafal

================
Rafal Raciborski
Graduate student
Department of Political Science
Emory University
301 Tarbutton Hall
1555 Dickey Drive
Atlanta, GA 30322
404-378-9826 (home)
[email protected] (e-mail)
www.roofoos.net

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