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

Re: st: parmby if=exp for strings


From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: parmby if=exp for strings
Date   Wed, 14 Jul 2004 20:05:58 +0100

At 19:50 14/07/2004, Douglas wrote:

Wrapping the parmby in single quotations keeps the parmby from executing:

. parmby `"regress mpg weight if inlist(make_1, "Datsun", "Buick")"', l(*)
You must specify at least one of the four options:
list(), saving(), norestore, and fast.
If you specify list(), then the output variables specified are listed.
If you specify saving(), then the new data set is output to a disk file.
If you specify norestore and/or fast, then the new data set is created in
the memory,
and any existing data set in the memory is destroyed.
For more details, see on-line help for parmby and parmest.
r(498);
The problem here is that the minimum abbreviation for -list()- is -li()- and not -l()-. The following works for me:


. sysuse auto, clear
(1978 Automobile Data)

. split make, gene(make_)
variables created as string:
make_1 make_2 make_3

. parmby `"regress mpg weight if inlist(make_1, "Datsun", "Buick")"', li(*)
Command: regress mpg weight if inlist(make_1, "Datsun", "Buick")

Source | SS df MS Number of obs = 11
-------------+------------------------------ F( 1, 9) = 31.85
Model | 239.15244 1 239.15244 Prob > F = 0.0003
Residual | 67.5748328 9 7.50831476 R-squared = 0.7797
-------------+------------------------------ Adj R-squared = 0.7552
Total | 306.727273 10 30.6727273 Root MSE = 2.7401

------------------------------------------------------------------------------
mpg | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
weight | -.0067701 .0011996 -5.64 0.000 -.0094838 -.0040565
_cons | 41.98515 3.714705 11.30 0.000 33.5819 50.3884
------------------------------------------------------------------------------

Listing of results:

+----------------------------------------------------------------------------------------------------+
| parmseq parm estimate stderr dof t p min95 max95 |
|----------------------------------------------------------------------------------------------------|
1. | 1 weight -.00677015 .00119959 9 -5.6437293 .00031612 -.00948381 -.00405649 |
2. | 2 _cons 41.98515 3.7147046 9 11.30242 1.280e-06 33.581905 50.388396 |
+----------------------------------------------------------------------------------------------------+


I hope this helps.

Roger


--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Website: http://www.kcl-phs.org.uk/rogernewson

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

*
* 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