Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Gannaway Jack WWG HWWD" <JACK.GANNAWAY@dwp.gsi.gov.uk> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: replacement |
Date | Tue, 16 Aug 2011 09:59:41 +0100 |
Statalisters, I have a table where each observation has a letter as the value for a number of the variables, e.g. Ob v1 v2 v3 1 a a b 2 c d a 3 b c b For each variable, there is a unique set of numbers which correspond to the letters: Var a b c d V1 0 3 5 9 V2 0 1 2 5 V3 0 1 5 10 Can anyone explain a neat way of replacing all the letters with their relevent numeric score? I know I could just do a messy and long replace, but the score table is liable to change in the future and I want a system where I can just point to a different input, rather than manually re-write the replace command. Many thanks in advance. Jack Gannaway ------------------------------------------------------------------------ ------------------------------- Jack Gannaway Economic Adviser | Department for Work & Pensions, Caxton House, Tothill Street, London, SW1H 9D jack.gannaway@dwp.gsi.gov.uk | Tel: 02074 495704 (x 65704) ********************************************************************** This document is strictly confidential and is intended only for use by the addressee. If you are not the intended recipient, any disclosure, copying, distribution or other action taken in reliance of the information contained in this e-mail is strictly prohibited. Any views expressed by the sender of this message are not necessarily those of the Department for Work and Pensions. If you have received this transmission in error, please use the reply function to tell us and then permanently delete what you have received. This email was scanned for viruses by the Department for Work and Pensions' anti-virus services and on leaving the Department was found to be virus free. Please note: Incoming and outgoing e-mail messages are routinely monitored for compliance with our policy on the use of electronic communications. ********************************************************************** * * 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/