addendum to what i've said earlier. it should be -outsheet- and not
-outfile-. and for more labour saving - assuming your permno variable
is a numeric variable, you might want to turn it into a string
variable. you write:
encode permno, generate(permno1) label(permno1)
drop permno1
that turns the permno1 back into numeric but now the numeric variable
has a label!!! as you can see I don't really care about the "permno1"
variable, all I want is to generate the label "permno1".
it's exciting because now after you have generate the count variable
(as I recommend in the earlier post), you can write:
label variable count permno1
decode count, generate(permno1)
outsheet permno1 permno_coeff if _n<=499 using permno.out, c replace
now count is a string variable, and because you outsheet it side by
side with permno_coeff, each of the coefficient will sit side by side
with a string variable that contains permno. you would only need to
destring it again to turn it back into the original numeric.
it may sound rather cumbersome so if anyone have thought of better way
of doing this, plesae chip in. cheers, ada
*
* 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/