Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str15 agency str12 issuer int ymd byte order float relate "A" "x" 20020 1 0 "A" "x" 20020 1 0 "A" "x" 20020 1 0 "A" "y" 20444 1 0 "A" "y" 20444 1 0 "A" "y" 20786 2 0 "A" "y" 20786 2 0 "A" "y" 20786 2 0 "A" "y" 20803 3 0 "A" "y" 20803 3 0 "A" "z" 21109 1 0 "A" "z" 21109 1 0 "A" "z" 21179 2 0 "A" "z" 21179 2 0 end format %tdnn/dd/CCYY ymd
- For each pair of agency and issuer, I'd like to to do the following calculation.
- If order = 1, then `relate' = 0.
- If order = 2, then `relate' is obtained by subtracting ymd when order =1 from ymd when order =2. Similarly, for order =3, the `relate' variable is again obtained by subtracting ymd when order =2 from ymd when order =3, and so on.
0 Response to calculating time differences (duration)
Post a Comment