[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Labeling values of variables

From   "Newson, Roger B" <>
To   <>
Subject   st: RE: Labeling values of variables
Date   Thu, 14 Feb 2008 14:16:20 -0000

A possible approach is to use the -descsave-, -parmest- and -factext-
packages, all downloadable from SSC. (If you are using an out-of-date
version of Stata, then you can download the old versions of these
packages from my website by typing, in Stata,
net from
and choosing the most recent version compatible with your system.)

For instance, you might write a program saying

tempfile df0
descsave relation sex, saving(`df0', replace)
xi: regress y i.relation*
parmest, label norestore
split label, parse(" & ") gene(S_)
factext, from(S_*) do(`df0')
list parm relation sex extimate min95 max95 p

The descsave command creates a temporary do-file, containing commands to
reconstruct variables relation and sex. The parmest command creates an
output dataset (or resultsset), replacing the pre-existing dataset in
memory, with 1 observation per fitted parameter of the regression model,
and data on parameter names, estimates, confidence limits, P-values,
variable labels, and other parameter attributes. The split command
splits the parameter variable label into 2 sub-label variabless S_1 and
S_2. The factext command reconstructs the 2 factors (relation and sex),
using the do=file created by factext. Finally, the list command lists
the parameters, with their associated values of relation and sex.

More information about -parmest- and other resultsset-creating and
resultsset-handling commands can be downloaded from my website (see my
signature below).

I hope this helps.

Best wishes


Roger B Newson
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Web page:
Departmental Web page:

Opinions expressed are those of the author, not of the institution.

-----Original Message-----
[] On Behalf Of Peter
Sent: 14 February 2008 13:56
Subject: st: Labeling values of variables

Dear Statalisters,

I like to have sensible value labels of variables, and use
   label define relation 0 "single" 1 "married" 2 "divorced"
   label define sex 0 "female" 1 "male"
in StataSE 8.2. However, when using
   xi i.relation *
the labels automatically become "relation==1 & sex==1", "relation==2 &
sex==1". How do I obtain labels which say "married male" and "divorced

@Nick: I know that I have to mention my version of Stata, but sometimes
I do forget...sorry.

Cheers, Peter
Psst! Geheimtipp: Online Games kostenlos spielen bei den GMX Free Games!
*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index