Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65642

Data manipulation (change address).

$
0
0
I have the following data. A1 is the address of corporation. A2 equals 0 if the corporation does not change address, and 2 (or 1 and 3 when id==2) means that the firm moves to a new address 2.
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(id year A1 A2)
1 2010 1 0
1 2011 1 2
1 2012 1 0
1 2013 1 0
2 2010 2 1
2 2011 2 0
2 2012 2 3
2 2013 2 0
end
My question is: H can I obtain the following results (A1 denotes the current address)?
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(id year A1 A2)
1 2010 1 0
1 2011 2 2
1 2012 2 0
1 2013 2 0
2 2010 1 1
2 2011 1 0
2 2012 3 3
2 2013 3 0
end

Viewing all articles
Browse latest Browse all 65642

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>