Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: replacement


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: replacement
Date   Tue, 16 Aug 2011 10:19:03 +0100

-label define- followed by -encode-.

Nick

On Tue, Aug 16, 2011 at 9:59 AM, Gannaway Jack WWG HWWD
<JACK.GANNAWAY@dwp.gsi.gov.uk> wrote:

> 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.

*
*   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   |   Site index