Statalist


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

st: RE: Labeling values of variables


From   "Newson, Roger B" <r.newson@imperial.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
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 http://www.imperial.ac.uk/nhli/r.newson/
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*i.sex
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


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
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: r.newson@imperial.ac.uk 
Web page: www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/pop
genetics/reph/

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

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Peter
Dijkstra
Sent: 14 February 2008 13:56
To: statalist@hsphsun2.harvard.edu
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 * i.sex
the labels automatically become "relation==1 & sex==1", "relation==2 &
sex==1". How do I obtain labels which say "married male" and "divorced
male"?

@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!

http://games.entertainment.web.de/de/entertainment/games/free
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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