I have a dataset with 3500 companies. Each company has a unique company ID (variable name is id), which is all number (To be precise, the data type is long $12.0g when I use inshee to load the data).
I can use reg y x i.id
I also tried
tostring id, gen(id2)
encode id2, gen(id2_c)
then
reg y x i.id2_c
I thought the two should have given me the identical result on x, but the fact is they are not. I am puzzle why is that. Your help would be greatly appreciated.
Related Posts with Treat numeric variables as factor variables
Event study moving average outside event windowThe following panel data provides information about the firm event PERMCO_ED which is unique. DATE i…
Using loops in MatrixHi all, I am trying to create a composite index on connectivity, by region (e.g. africa, european u…
control row / colum percent display in svy jackknifewhen i do this: svy jackknife, subpop (if charflag==2 & SCHLEV_3CAT==2 & teach_pe_di==2 ): …
-centile command-Dear Stata users, I am wondering, is it possible to generate upper and lower 95% CI of variable V1 …
Creating weighted average return of portfolioI have a question concerning the average return of a portfolio. I created 2 groups of stocks, one w…
Subscribe to:
Post Comments (Atom)
0 Response to Treat numeric variables as factor variables
Post a Comment