Hi I am working on a set of panel data and I want to tell stata that I am working on panel data by using the command xtset. I tried to use "xtset year code" but stata responded as this "string variables not allowed in varlist; code is a string variable".
The company code I am using contains both number and letters. In this case, how can I proceed to tell stata with the command xtset? Should I destring variable code or generate a new variable to replace code? Can anyone offer me some advice? thank you!
The company code I am using contains both number and letters. In this case, how can I proceed to tell stata with the command xtset? Should I destring variable code or generate a new variable to replace code? Can anyone offer me some advice? thank you!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str30 name int year str6 code int sic double(cash ta) float size double(ebit capex mtb) "2 TRAVEL GROUP PLC" 2002 "26702E" 7329 . . . . . . "365 MEDIA GROUP PLC" 2003 "257J33" 7999 . . . . . . "3I GROUP PLC" 2010 "960438" 6282 . 7081000 14.800778 223900 11300 1.28 "3I INFRASTRUCTURE" 2005 "51266Q" 6726 . . . . . . "3M COMPANY" 2008 "143982" 3841 301000 14379000 11.48128 3085000 1115000 . end
Comment