Hello, I have two variables, IS and Code. I would like IS to take on different values depending on what Code is. For example, I would like IS to equal 10401 if Code = 10085, 10087, 10090, 10091, 10095, or 60031. I would like IS to equal 10402 if Code = 10094, 10164, 60027, 60029, 60032, 60033 or 60034.
In this way I am trying to map about 900 Code values to about 100 IS values. Is there a relatively quick way I can do this using loops and groups instead of doing replace IS over and over again? I am very new to Stata and do not have much experience.
Related Posts with Creating new var w/ multiple values of another var
Loading do-file editor and other windows on startupI tend to load the do-file editor right after I start Stata. I often also open the data editor and v…
Panel dataset of Matched sample using rangejoinDear Statalisters, I want to see the effect of a law which came into effect on 1975 on the lnpatent…
Date precisionIf I do this: . gen double d=clock("20200101 01:01:01", "YMD hms") . format %tC d . browse then …
Advice regarding Ramsey RESET test resultHello, I'm running an OLS regression with around 2000 observations and a few variables - most of th…
cap file commandsHi all I have a problem with the following code (I got it by a colleague...): use "${logpath}\cou…
Subscribe to:
Post Comments (Atom)
0 Response to Creating new var w/ multiple values of another var
Post a Comment