Bookmark and Share

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]

st: extract rownames corresponding to data as unique codes


From   Judy You <joodyu@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: extract rownames corresponding to data as unique codes
Date   Thu, 7 Jul 2011 11:37:16 +0930

 Dear Stata experts:

I am running a “dstdize” age-standardised rate syntax and got a result
with Crude and age-adjusted rate, together with lower and upper limit.

The age adjusted rate is reported by SLA level (which there are 95
rows or records). I have save the matrix in a file but the result
doesn’t come along with SLA code. I could force it to do by merge the
predefined file with sla code to the one saved in the matrix. I
believer there should be the smart way to do.

Here is my log file. Thanks for your help in advance!

----------

. qui dstdize freq pop sex agegp, by(sla) using (t0)

. drop _all

. return list

scalars:
                  r(k) =  95

macros:
                 r(by) : "sla"
                r(c95) : "`"5050"'"
                r(c94) : "`"5000"'"
                r(c93) : "`"4809"'"
------
                 r(c3) : "`"205"'"
                 r(c2) : "`"203"'"
                 r(c1) : "`"201"'"

matrices:
                 r(se) :  1 x 95
                 r(ub) :  1 x 95
                 r(lb) :  1 x 95
                r(adj) :  1 x 95
              r(crude) :  1 x 95
               r(Nobs) :  1 x 95

. matrix C = r(crude)', r(adj)', r(lb)' , r(ub)'

. svmat C, names(col)
number of observations will be reset to 95 Press any key to continue,
or Break to abort obs was 0, now 95

. save t1,replace
file t1.dta saved

Crude	Adjusted	Left	Right
.0144418	.0213993	.0160632	.0267354
.0242798	.0409689	.030746	.0511917
.0123417	.0186174	.0149574	.0222773
.0097357	.0142612	.0108197	.0177028
.0260393	.051086	.0389991	.0631729

-----


The saved file looks like that, but what I like is to have a column
named as SLA, corresponding to the SLA codes in the original data.
Could any expert give me some hint?

Cheers

Judy

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


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