Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Use of macro content stored in r()
From
Evelyne Fournier <[email protected]>
To
<[email protected]>
Subject
st: Use of macro content stored in r()
Date
Thu, 21 Jun 2012 11:42:40 +0200
Dear statalist members,
I have a file containing agregated data of cancer cases (nbcas) and
at-risk population (pop) per gender, periode and cancer localisation (loc).
Using the following command, I get the standardised incidence rate per
those variables :
dstdize nbcas pop clage, by(sex periode loc) using(c:\data\refmonde.dta)
I would like to automatically export the incidence rates. This can be
done thanks to -mat2txt- ( Michael Blasnik, available from SSC).
mat ADJ = r(adj)
mat2txt, matrix(ADJ) saving("C:\data\taux_ajust.txt") replace
The thing is, the created file contains k columns (for exemple k=40
columns) with names ranging from C1 to C40.
Thanks to the command -return list-, I can see that column named C1 of
file "taux_ajust.txt" contains the incidence rate of kidney cancer for
men in 1980.
-------begin of log copy
return list
scalars:
r(k) = 40
macros:
r(by) : "sex periode loc"
r(c40) : "`"2"' `"2009"' `"lung"'"
///
r(c1) : "`"1"' `"1980"' `"kidney"'"
------end of log copy
These informations (contents of r(c1)..r(ck)) are stored in macros, and
I'm stuck here.
Is there anyway I could get a file where both information (column name
C1..Ck and corresponding macro content stored in (r(c1)..r(ck) ) would
be together ?
(ex: C1 "`"1"' `"1980"' `"kidney"'" ; /// ;C40 "2"' `"2009"' `"lung"'")
I use Stata IC 11.2 for Windows (32-bit), revision 16th February 2012.
Thanks a lot for your help
Evelyne
--
Evelyne Fournier
Registre des Tumeurs du Doubs et du Territoire de Belfort
CH Saint Jacques
25030 Besançon Cedex
Tel : 03 81 21 83 14
mail : [email protected]
site registre : http://www.chu-besancon.fr/registretumeursdoubs/
begin:vcard
fn:Evelyne Fournier
n:Fournier;Evelyne
org:CHU Besancon;Registre des tumeurs du Doubs
adr:;;2 Place Saint Jacques;Besancon;;25000;France
email;internet:[email protected]
tel;quoted-printable;work:18314 (depuis l'int=C3=A9rieur) ou 03 81 21 83 14
version:2.1
end:vcard