Hi Statalist,
I am stuck with a very silly problem which I am unable to work out. Please consider the following example data:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(var1 var2 var3)
1 11 .
1 12 2
1 13 .
2 21 .
2 22 .
2 23 4
2 24 .
3 31 .
3 32 .
3 33 3
end
now i want to generate a variable, say var4 such that the data looks like this:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(var1 var2 var3 var4)
1 11 . 2
1 12 2 2
1 13 . 2
2 21 . 4
2 22 . 4
2 23 4 4
2 24 . 4
3 31 . 3
3 32 . 3
3 33 3 3
end
that is, the var4 should be such that, for observations belonging to same var1, it records a value = var3 against each of the observations.
Any guidance towards solving this problem is greatly appreciated.

Thanks,
Titir