Statalist


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

st: Re: Create a new variable based on some other variables


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Create a new variable based on some other variables
Date   Wed, 20 May 2009 21:01:25 +0200

<>

Look at Nick`s http://www.stata-journal.com/sjpdf.html?articlenum=pr0016



HTH
Martin
_______________________
----- Original Message ----- From: "Charles Man@CCR" <ccrman@cityu.edu.hk>
To: <statalist@hsphsun2.harvard.edu>
Sent: Wednesday, May 20, 2009 8:56 PM
Subject: st: Create a new variable based on some other variables


Dear Statalisters,

If I want to create a new variable based on the values of a few other variables, how can I do that?

For instance,

Create B
If A1=1, then B=1
If A2=3, then B=2
If A3=8, then B=3

Can -gen- or -egen- or -recode- do this job?

Thanks,
Charles
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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