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, is already up and running.

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

st: routine for matching of a str-variable

From   Thomas Zimmermann <>
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)"
2 Memantine N06DX01
3 Estron G03CA07
4 Promestrien G03CA09

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

Dr. Thomas Zimmermann
Department of Primary Medical Care
University Medical Center Hamburg-Eppendorf
Martinistr. 52
D-20246 Hamburg
+49 40 7410 56066

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

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

Prof. Dr. Jörg F. Debatin (Vorsitzender)
Dr. Alexander Kirstein
Joachim Prölß
Prof. Dr. Dr. Uwe Koch-Gromus
*   For searches and help try:

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