Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: Extended macro problem


From   Fred Wolfe <[email protected]>
To   [email protected]
Subject   Re: st: Re: Extended macro problem
Date   Tue, 01 Jun 2004 05:47:49 -0500

Thanks to Roger and Kaleb. Kaleb's solution works, but only if you know the valuelabelname. Ordinarily that will not be known, so I didn't take that path.




Or Fred could have written the malfunctioning line as

local `catvar'lab`num': label (`catvar') `num'

(note the parentheses), which refers to the label of the variable stored in the macro -catvar-. See -[P] macro- for details.
Thanks! I missed the parenthesis when I read the text. I saw the parenthesis as part of the formatting of the - [P] macro page rather than as part of the necessary code. Thanks, the program works now.



Or, alternatively, Fred might like to use the -factext- package, downloadable from my website. (A fully up to date version should be on SSC as soon as Kit gets back to Boston.) The -factext- package inputs the -label- variable in a -parmby- output and re-creates the categorical factors, sometimes with help from the -descsave- package, which is also on SSC. The categorical factors can then be used in plots and tables.
I am indebted to Roger for his parmest program, but took a different tack in displaying the results for several reasons. First, I use -tlabels-, a secondary labelling system (see -fsum- ssc install fsum,replace). Roger's program are not designed for that. The program I am working on uses tlabels if they are present, otherwise uses regular labels. Second, I wanted a simple program for non-sophisticated users for whom the utilities Roger provides might seem too complicated. Third, I wanted some special formatting of confidence intervals that are not available in Roger's superb series of programs. Here is an example of running my new program (yet unfinished).

Thanks again to Roger.

. parmby "xi:logistic married haq pain sex fatigue age edlevel ", label eform format(estimate min95 max95 %8.2f p %8.1e) saving(killme,replace)
Command: xi:logistic married haq pain sex fatigue age edlevel

Logistic regression Number of obs = 7415
LR chi2(6) = 349.84
Prob > chi2 = 0.0000
Log likelihood = -4300.4191 Pseudo R2 = 0.0391

------------------------------------------------------------------------------
married | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
haq_disabi~y | .8428295 .0411647 -3.50 0.000 .7658894 .9274987
pain_scale | .9860523 .0132516 -1.05 0.296 .9604188 1.01237
sex | 2.829347 .2200756 13.37 0.000 2.429277 3.295303
fatigue_sc~e | 1.003245 .0121197 0.27 0.789 .9797697 1.027283
age | .9805909 .0021429 -8.97 0.000 .9763998 .9848
edlevel | .999307 .011803 -0.06 0.953 .9764393 1.02271
------------------------------------------------------------------------------
file killme.dta saved

. showparmest using killme, sort ciform(to)

Variable Odds Ratio 95% C.I. P value
Sex (% male) 2.83 (2.43 to 3.30) 8.9e-41
Age (years) 0.98 (0.98 to 0.98) 3.0e-19
HAQ (0-3) 0.84 (0.77 to 0.93) 4.6e-04
Pain (0-10) 0.99 (0.96 to 1.01) 3.0e-01
Fatigue (0-10) 1.00 (0.98 to 1.03) 7.9e-01
Education (years) 1.00 (0.98 to 1.02) 9.5e-01
Constant 8.50 (5.37 to 13.46) 7.0e-20

file killme.dta saved



I hope this helps.

Best wishes

Roger

Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
Tel (316) 263-2125     Fax (316) 263-0761
[email protected]


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index