Dear all,
I have a data handling question which should be basic but for which I don't figure out the answer, hopefully someone else will easily.
I have a table of size 101*101, where the 100 rows/lines below the top one contain 100 origins and the 100 columns next to the 1st one contain 100 destinations. The bottom left triangle of about half the cells contain the distances, the top right triangle with the iother half are empty. As driving from B to A is just as far as driving from A to B, I'd like to replace any distance from B to A which is missing with the distance from A to B which is not missing, but I don't know how to best program this.
One idea I had was to Create 10'000 groups of 1-2 elements each such that (A,B) and (B,A) are in the same group. Then I could just use -bysort group (distance): replace distance = distance[1]- to replace the missing with the non-missing distance. But when I -egen group = group(origin destination)-, then (A,B) and (B,A) are treated as separate.
Would anyone know how to solve this?
Thank you so much, PM
Related Posts with Assign (A,B) and (B,A) to the same group?
Standard Error Correction in a two step processDear all I wonder if anyone has any references, and perhaps Stata applications, that can help me sol…
Showing country-specific treatment effectsHello, I'm currently working with a dataset with individual respondents. In my analysis, I show the…
Inverted Normal GraphHello all, Admittedly a mundane question here... I'm simply trying to plot an inverted normal distr…
WLS regression using regwls and regressDear All, I have a question regarding WLS regression using Stata commands regwls and regress and wo…
How to do matrix exponential operation in Stata? Code: matrix A = (1,0,0,0,0\0.6,0,.4,0,0\0,.6,0,.4,0\0,0,.6,0,.4\0,0,0,0,1) matrix list A matrix B…
Subscribe to:
Post Comments (Atom)
0 Response to Assign (A,B) and (B,A) to the same group?
Post a Comment