Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Roger Newson <r.newson@imperial.ac.uk> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: parmby: how to get value lables in output? |

Date |
Mon, 3 May 2010 20:32:07 +0100 |

The code should have been: tempfile df0 descsave DE4A_5yr, do)`"`df0'"')

destring parm, gene(DE4A_5yr) do `"`df0'"' list

I hope this helps. Best wishes Roger Roger B Newson BSc MSc DPhil 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: http://www.imperial.ac.uk/nhli/r.newson/ Departmental Web page: http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/ Opinions expressed are those of the author, not of the institution. On 03/05/2010 19:31, Roger Newson wrote:

The best answer to this is probably to use the -nolabel- option for the -proportion- command, to extract the numeric values from the -parm- variable in the -parmby- output dataset, and to reconstruct the variable -DE4a_5yr- in the output dataset using the official Stata commands -split- and -destring- with the -descsave- package, which ypu can download from SSC. The -descsave- command is an extended version of -describe-, and is a Stata program which writes Stata programs. Your code might be: tempfile df0 descsave DE4A_5yr, do)`"`df0'"') parmby "svy: proportion DE4A_5yr, nolabel missing", norestore rename(estimate Proportion) split parm, parse(:) gene(S_) destring S_2, gene(DE4a_5yr) drop S_* do `"`df0'"' list The -tempfile- command creates a name for a temporary do-file. The -descsave- command creates that temporary do-file, which contains commands to reconstruct any variable labels, value labels, formats and storage types for the variable -DE4A_5yr-. The -parmby- command is like the one in Anupam's code, but it does not rename the variable -parm- in the output dataset, and -proportion- has the -nolabel- option, so that the new variable -parm- will contain only numeric values for -DE4A_5yr-. The -split- command inputs the -aprm- command and outputs 2 new variables -S_1- and -S_2-, containing the contents of -parm- to the left and to the right of the colon (:). The -destring- command inputs S_2, which will contain character representations of the numeric values of -DE4A_5yr-, and outputs the numeric variable -DE4A_5yr-. The -drop- command drops the temporary variables -S_1- and -S_2-. The -do- command executes the temporary do-file to reconstruct the variable attributes (including value labels) for the variable -DE4A_5yr-. Finally, the -list- command displays the output dataset, which should now include the new variable -DE4A_5yr-, reconstructed in the output dataset, complete with value labels. I hope this helps. Best wishes Roger Roger B Newson BSc MSc DPhil 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: http://www.imperial.ac.uk/nhli/r.newson/ Departmental Web page: http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/ Opinions expressed are those of the author, not of the institution. On 01/05/2010 09:05, Anupam wrote:How to get value labels in the output from parmby? Instead of _prop_1 prop_2, etc., I want value labels (see below). Thanks for your consideration. Command and output are below: . parmby "svy: proportion DE4A_5yr, missing", norestore rename(parm de4a_5yr estimate Proportion) Command: svy: proportion DE4A_5yr, missing (running proportion on estimation sample) Survey: Proportion estimation Number of strata = 1 Number of obs = 215754 Number of PSUs = 2474 Population size = 1.0e+09 Design df = 2473 _prop_1: DE4A_5yr = 0- _prop_2: DE4A_5yr = 5- _prop_3: DE4A_5yr = 10- _prop_4: DE4A_5yr = 15- _prop_5: DE4A_5yr = 20- _prop_6: DE4A_5yr = 25- _prop_7: DE4A_5yr = 30- _prop_8: DE4A_5yr = 35- _prop_9: DE4A_5yr = 40- _prop_10: DE4A_5yr = 45- _prop_11: DE4A_5yr = 50- _prop_12: DE4A_5yr = 55- _prop_13: DE4A_5yr = 60- _prop_14: DE4A_5yr = 65- _prop_15: DE4A_5yr = 70- _prop_16: DE4A_5yr = 75- _prop_17: DE4A_5yr = 80- _prop_18: DE4A_5yr = . -------------------------------------------------------------- | Linearized Binomial Wald | Proportion Std. Err. [95% Conf. Interval] -------------+------------------------------------------------ DE4A_5yr | _prop_1 | .0066759 .0009649 .0047838 .008568 _prop_2 | .001211 .0002921 .0006382 .0017839 _prop_3 | .0009341 .0003057 .0003347 .0015335 _prop_4 | .001101 .0003248 .0004642 .0017379 _prop_5 | .0010596 .0002144 .0006392 .00148 _prop_6 | .0018453 .0006205 .0006286 .0030621 _prop_7 | .0010639 .000279 .0005167 .0016111 _prop_8 | .0015552 .0004017 .0007674 .0023429 _prop_9 | .0012013 .0002554 .0007004 .0017022 _prop_10 | .0021859 .0004139 .0013742 .0029975 _prop_11 | .0014081 .0002065 .0010031 .0018131 _prop_12 | .0020961 .0004735 .0011677 .0030246 _prop_13 | .0032379 .0006099 .0020419 .0044339 _prop_14 | .0061096 .0019506 .0022846 .0099346 _prop_15 | .0054201 .000871 .0037121 .0071282 _prop_16 | .0030363 .0004292 .0021947 .0038779 _prop_17 | .0068777 .0006943 .0055161 .0082392 _prop_18 | .9529809 .0028802 .947333 .9586288 -------------------------------------------------------------- * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: parmby: how to get value lables in output?***From:*"Anupam" <anupamtg@gmail.com>

**Re: st: parmby: how to get value lables in output?***From:*Roger Newson <r.newson@imperial.ac.uk>

- Prev by Date:
**Re: st: mim: gllamm and estimates store** - Next by Date:
**Re: st: creating variable from svy: proportion** - Previous by thread:
**Re: st: parmby: how to get value lables in output?** - Next by thread:
**Re: st: Logistic regression and log-transformation of covariates** - Index(es):