Bookmark and Share

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


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

Re: st: replacement


From   Nick Cox <[email protected]>
To   [email protected]
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
<[email protected]> 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index