Hi all!
I hope you can guide me in the following question. In te following dataset:
id Ya Yb id_2
1-1 .6249384 .7929984 1-1
1-1 . . 1-2
1-1 . . 2-1
1-2 . . 1-1
1-2 .6531338 .5850651 1-2
1-2 . . 2-1
2-1 . . 1-1
2-1 . . 1-2
2-1 .8717756 .890541 2-1
How can I replace the value of Ya for id == 1,1, for all observations that meet id == 1,1?
and so also for Yb, but with the variable id_2?
The goal is to get the following dataset:
id Ya Yb id_2
1-1 .6249384 .7929984 1-1
1-1 .6249384 .5850651 1-2
1-1 .6249384 .890541 2-1
1-2 .6531338 .7929984 1-1
1-2 .6531338 .5850651 1-2
1-2 .6531338 .890541 2-1
2-1 .8717756 .7929984 1-1
2-1 .8717756 .5850651 1-2
2-1 .8717756 .890541 2-1
Thank you very much in advance.
Greetings,
Related Posts with Replace values of one variable according to the categories of another
Error using esrefline in meta forestplot in Stata 16SEHi I get an error "option esrefline not allowed" "r(198)" using meta forestplot. I have Stata v16SE.…
Manipulating with string variablesHi all, I am using STATA 15.1 and I have a new problem and it is a challenge, at least for me if I …
how to find matched pairs (treatments & controls) when running Coarsened Exact Matching (CEM) reposting the questionMy apology that I re-posted the same question. I assume that I didn't get any answers since my previ…
How to count distinct observations by group?Dear experts, I have a dataset like below. I'd like to count distinct firm numbers by province. For…
pscore not working in STATA 16Hi, I have used pscore in the past on STATA 13. Today, I tried it for the first time on STATA 16 an…
Subscribe to:
Post Comments (Atom)
0 Response to Replace values of one variable according to the categories of another
Post a Comment