Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Assigned sex

From   Marcello Pagano <>
Subject   st: Assigned sex
Date   Wed, 22 Dec 2010 07:50:34 -0500

-------- Original Message --------





Dear stata-listers,

I would like some help is using the 'recode' command (or any other appropriate one)
to reformat one of my variables.

The variable 'sex' describes what sex each of my subjects is assigned to.
The variable looks like this:

. sum sex

    Variable |       Obs        Mean    Std. Dev.       Min        Max
         sex |         0

. tab sex

      c:sex |      Freq.     Percent        Cum.
          F |        584       48.50       48.50
          M |        620       51.50      100.00
      Total |      1,204      100.00

As you can see the above variable isn't particularly useful for regression,
and basic statistics that I would like to use it for. How would I somehow recode
the variable, such that all boys are coded as 1 and girls as 2?? And the number
of observations will be listed as 1,204 when the variable is summarized?

As of now the varibale is the 'str1' format.



Amal Khanolkar, PhD candidate,
Centre for Health Equity Studies (CHESS),
Karolinska Institutet,
106 91 Stockholm.

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index