something like
gen var=.
for oldval in num 2 3 ... \ newvar in num 1 6 ... : replace var=newvar if x==oldvar
Best Lars
On Mon, 21 Oct 2002, Kompal Sinha wrote:
> Hi there,
> I want to generate a new variable based on a variable x. That is the new
> variable should have value 1 if x=2, value 6 if x=3 and so on. How do I
> proceed.
> Thanks
> kompal
>
> *
> * 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/
>
............................................
: Lars Korsholm Ph.D., :
: Department of Statistics and Demography :
: University of Southern Denmark :
: Sdr. Boulevard 23A, 1. :
: DK-5000 Odense C :
: Phone +45 6550 3608 :
: Fax +45 6595 7766 :
: Mail [email protected] :
: Web http://www.isd.sdu.dk/~korsholm :
:..........................................:
*
* 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/