Dear all,
I am trying to complete a panel data regression with the individual and time identifiers: company and year, respectively. I am using cusip8-codes as the company identifiers, which can be comprised of numbers and characters (e.g. 80306210 or 00484M10). In my dataset the cusip8 variable is a string variable. Therefore I get the following error when trying to set the panel identifiers:
. xtset cusip pyear
string variables not allowed in varlist;
cusip8 is a string variable
r(109);
I've tried to destring the variable but without any results:
. destring cusip8, replace
cusip8: contains nonnumeric characters; no replace
If I try the following formula (which I found on this forum) I end up with blanks (".") for all the cusip8's that contained a character.
. destring cusip, gen(cusip8) force
cusip: contains nonnumeric characters; cusip8 generated as double
(76235 missing values generated)
How can I fix this problem?
Kind regards,
Danielle
0 Response to STATA: panel regression, xtset error, CUSIP8-code, string variable
Post a Comment