Alek Z
Alek Z

Reputation: 11

Include variable names in estout along with factor variable values

I'm trying to get estout to output the variable name along with the labels for individual values. For instance I have a variable labeled AgeGroup with values 0-9, 10-19, etc. estout only includes the label values.

For instance: eststo: logistic DepVar i.AGEGROUP i.RACE estout est1 using regress_M.txt,label

My output is:

DepVarLabel
1_AgeGroup Value label
2_AgeGroup Value label
1_Race Value label
2_Race Value label

What I want is:

DepVarLabel
Age Group
1_AgeGroup Value label
2_AgeGroup Value label
Race
1_Race Value label
2_Race Value label

Upvotes: 1

Views: 1254

Answers (1)

Eric HB
Eric HB

Reputation: 887

One way to deal with the issue is using the refcat option.

Here is an example:

sysuse auto, clear
xi: logit foreign i.rep78 i.trunk
estout . using example.txt, ///
    refcat(_Irep78_2 "Rep 78 Categories" _Itrunk_6 ///
    "Trunk Categories", nolabel) label replace

The output should be closer to what you are looking for. Note the use of xi: is necessary here because it allows us to call the factor variables _Ivar_value.

Upvotes: 2

Related Questions