[EpiData-list] EpiData-list Selection of cases with special digits within a longer variable

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Tue Oct 27 12:09:59 CDT 2009


...or do in EpiData analysis:

select substr(cpr,5,4)="1940"

savedata "1940_only.rec" /replace

Hans

Do this:

define cprtxt __________ // string of length 10
define yrtxt __ // string of length 2
cprtxt = cpr
yrtxt = copy(cprtxt,5,2) // digits 5 & 6
select yrtxt = "40"

This can also be done in a single line, if you have no other use for the
year of birth:

select copy(cpr,5,6)="40"

Jamie Hockin

2009/10/27 Jes Lindholt wrote:

> In Denmark, we have the unique CPR number consisting of birthdate (ddmmyy)
> followed by 4 numbers. If I have to select a population born in fx 1940 from
> a larger epidata-fil, I consider to use the export facility, but then need
> an observation filter only selecting those born in 1940, which means those
> numbered 40, in position 5 and 6 in the 10 digit CPR variable. Do anybody
> have knowledge of a relevant syntax for that?
>


-- 
Hans L Rieder, MD, MPH
Jetzikofenstr 12
3038 Kirchlindach
  Switzerland

Tel: +41 31 829 4577
Mob: +41 79 321 9122
Web: http://www.tbrieder.org




More information about the EpiData-list mailing list