--- Maarten buis <[email protected]> wrote:
> In order to get what you want it is sometimes easier to temorarily
> loose parts of your data, for instance the duplications of firms in
> your dataset. You can do that temporarily with the command -preserve-
> and -restore-. This is what I have done the example below.
hmmm, I actually forgot to put in the line -preserve-. The example
should be:
*-------------- begin example ---------------
/* getting the data in Stata */
clear
input str1 Firm Stage Investors str9 Date
A 1 1 " 1 Oct 96"
A 2 2 " 1 Apr 97"
A 2 2 " 1 Apr 97"
B 1 2 "28 Mar 01"
B 1 2 "28 Mar 01"
C 1 1 " 1 Feb 01"
C 2 1 " 1 Feb 02"
C 3 1 " 1 Feb 03"
D 1 3 "15 May 95"
D 1 3 "15 May 95"
D 1 3 "15 May 95"
end
gen stdate = date(Date, "dmy", 2040)
format stdate %td
/* duplicates are unnecesary and complicating for this task */
/* so I loose them, but I use -preserve- so I can -restore- */
/* the data when I am done */
preserve
sort Firm Stage
by Firm Stage: keep if _n==1
/* table of count syndicated by stage */
gen syndicated = Investors >=2
table Stage, c(sum syndicated) row
/* duration till syndicated */
gen firstsyn = stdate if syndicated == 1
format firstsyn %td
collapse (min) stdate firstsyn, by(Firm)
gen time = firstsyn - stdate
list
restore
*--------------- end example ----------------
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
Send instant messages to your online friends http://uk.messenger.yahoo.com
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/