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

st: RE: dstdize: still no labels


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: dstdize: still no labels
Date   Mon, 18 Nov 2002 14:58:24 -0000

Colin M Fischbacher
>
> As I explained in my original posting, my problem is that
> the output of
> -dstdize- is less readable than it could be because it lacks value
> labels. The output I get (in Stata 7) looks like this (the column of
> figures down the left are unlabelled values):
>
> .  dstdize diabz pop age_band sex, by(ethnic2 igt_stat) using
> ("D:\cmf\02 RESEARCH\misc\stats\ew1991.dta")
>
> . . . detailed output of tables omitted . . .
>
> Summary of Study Populations:
> ethnic2
> igt_stat             N      Crude     Adj_Rate
> Confidence Interval
> ------------------------------------------------------------
> ------------
> --
> 0
> 1            48   0.041667     0.016955    [  0.000000,    0.041110]
> 0
> 2            24   0.083333     0.059517    [  0.000000,    0.129379]
> 0
> 3            22   0.227273     0.259115    [  0.209528,    0.308701]
> 1
> 1            51   0.019608     0.012068    [  0.000000,    0.034194]
> 1
> 2            11   0.181818     0.183187    [  0.103009,    0.263364]
> 1
> 3            36   0.305556     0.440181    [  0.352302,    0.528061]
>
> But a cross tab (for example) of the two grouping variables (IGT is
> impaired glucose tolerance) confirms that they do have value labels:
>
> . tab igt_stat ethnic2
>
> igt status |
>         at |     ethnic group
>   baseline |  European  South Asi |     Total
> -----------+----------------------+----------
>   controls |        48         51 |        99
>   IGT once |        24         11 |        35
>  IGT twice |        23         36 |        59
> -----------+----------------------+----------
>      Total |        95         98 |       193
>
> I tried shortening the value labels but this makes no difference. I
> misunderstood Nick's previous posting to be suggesting that
> obtaining
> value labels would require a modification to the source
> code - this is
> clearly not what he meant; the help files don't suggest
> that an option
> of any kind is missing.

We were talking at cross purposes.

I was looking at the code for the main
body of the output.

Colin's right: as this example makes clear,
for the "Summary of study populations"
at the end of its output -dstdize- does not respect
value labels of -by()- variables. You get a numeric value
shown or at most the first 9 characters of a string value.
My guess is that this design decision was driven by how much
space is available for what has to be printed.
Or, arguably, Colin has
found a small bug: within -dstdize- the command
works with -decode-d values of one group
of variables, but it doesn't do that for
its -by()- arguments.

For the moment, the upstream fix is to -decode-:

decode igt_stat, gen(sigt_stat)
decode ethnic2, gen(sethnic2)

or

foreach v of var igt_stat ethnic2 {
	decode `v', gen(s`v')
}

Then

dstdize diabz pop age_band sex, by(sethnic2 sigt_stat) using
("D:\cmf\02 RESEARCH\misc\stats\ew1991.dta")

That will improve things. You will still get truncation
to (e.g) "South Asi".

Nick
n.j.cox@durham.ac.uk

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