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

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

From |
Nick Cox <njcoxstata@gmail.com> |

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

Subject |
Re: st: RE: extract rownames corresponding to data as unique codes |

Date |
Tue, 2 Aug 2011 08:01:02 +0100 |

You don't show the exact code you used to provoke such an error message. Nick On 2 Aug 2011, at 02:12, Judy You <joodyu@gmail.com> wrote:

Dear Nick, i have tried your command, it gives me error message. 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 number of observations will be reset to 95 Press any key to continue, or Break to abort obs was 0, now 95 (95 missing values generated) type mismatch r(109); end of do-file r(109); What i like to have SLAs (area codes) maintain the original source (numeric format),eg., sla=201, 203 205 --- 4809, 5000 5050 etc.. instead of 1 to 95. Cheers Judy 2011/7/13 Judy You <joodyu@gmail.com>Thanks Nick for your promptous response. SLA is an area code. Since i am away and have no stata program in my hand, i ccouldn't try to run it now, but i trust it will work fine. Cheers Judy 2011/7/11 Nick Cox <n.j.cox@durham.ac.uk>:I don't know what SLAs are.In your case, the row names, originally column names, areapparently all numbers, so you should be able to loop over thenames and store them in a variable (_not_ column) something likethis:qui dstdize freq pop sex agegp, by(sla) using (t0) drop _all return list matrix C = r(crude)', r(adj)', r(lb)' , r(ub)' svmat C, names(col) gen rowname = . qui forval i = 1/95 { replace rowname = r(c`i') in `i' } Nick n.j.cox@durham.ac.uk Judy YouI am running a "dstdize" age-standardised rate syntax and got aresultwith Crude and age-adjusted rate, together with lower and upperlimit.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 resultdoesn't come along with SLA code. I could force it to do by mergethepredefined 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 tocontinue,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? * * 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/

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

**Follow-Ups**:**Re: st: RE: extract rownames corresponding to data as unique codes***From:*Judy You <joodyu@gmail.com>

**References**:**Re: st: RE: extract rownames corresponding to data as unique codes***From:*Judy You <joodyu@gmail.com>

- Prev by Date:
**Re: st: RE: extract rownames corresponding to data as unique codes** - Next by Date:
**st: Artificial censoring in survival analysis** - Previous by thread:
**Re: st: RE: extract rownames corresponding to data as unique codes** - Next by thread:
**Re: st: RE: extract rownames corresponding to data as unique codes** - Index(es):