Bookmark and Share

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: routine for matching of a str-variable


From   Thomas Zimmermann <[email protected]>
To   [email protected]
Subject   st: routine for matching of a str-variable
Date   Wed, 11 May 2011 18:52:45 +0200

Dear Stata-Listers,

I want to check the prevalence of 200+ pharmaceutical agents in a dataset of 14000+ ATC-codes in 3327 patients. The table with the pharmaceutical agents is organised this way:

"pharmaceutical agent (str)" "atc-code (str)"
i=1
2 Memantine N06DX01
3 Estron G03CA07
4 Promestrien G03CA09
i=200


I'm looking for a routine that first creates a new variable "atc- code". this var should store the information (1), if the atc-code is matched, (0) if it's not.

my workaround (if it deserves that name) til now is to copy 200+times, then re"submit" the different atc-code by hand, :-(.

gen byte N06DX01 = regexm(atc-code, "^[N]+[0]+[6]+[D]+[X]+[0]+[1]+")
label var N06DX01 "Memantine"
tabulate N06DX01

is there any helpful automatization out there?

best regards
thomas


--
Dr. Thomas Zimmermann
Department of Primary Medical Care
University Medical Center Hamburg-Eppendorf
Martinistr. 52
D-20246 Hamburg
+49 40 7410 56066
--
http://www.zettmann.de



--
Pflichtangaben gemäß Gesetz über elektronische Handelsregister und Genossenschaftsregister sowie das Unternehmensregister (EHUG):

Universitätsklinikum Hamburg-Eppendorf
Körperschaft des öffentlichen Rechts
Gerichtsstand: Hamburg

Vorstandsmitglieder:
Prof. Dr. Jörg F. Debatin (Vorsitzender)
Dr. Alexander Kirstein
Joachim Prölß
Prof. Dr. Dr. Uwe Koch-Gromus
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index