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
table creation after foreach and selecting variablesHello everybody and thanks in advance. I'm wondering how to create tables in Stata 16 after a loop v…
Implementing a loop in rclass programDear all, I would like to implement a loop over a dependent variable in an rclass program. This is…
Removing the variable name and equals sign from legends without using legend(lab()) ?Hi, I am trying to create a series of Kaplan-Meier survival curves based on a series of categorical …
Dropping observations of a variableHey all, Wonderful community here. I'm new to coding in stata. I was curious if someone could walk …
Estimate parameters of an indicator* that* minimize the difference between current GDP and potential GDP.Dear all, I am having a macro panel for a larger period of years and for a number of countries with…
Subscribe to:
Post Comments (Atom)
0 Response to Treat numeric variables as factor variables
Post a Comment