[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 09:26:03 CDT 2009

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?

More information about the EpiData-list mailing list