EpiData-list Selection of cases with special digits within a longer variable
...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?
Correction! Since only 2 digits of year of birth are included, the syntax should be
select copy(cpr,5,2)="40" or select substr(cpr,5,2)="40"
Jamie
2009/10/27 epidata-list@lists.umanitoba.ca
...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?
participants (1)
-
epidata-list@lists.umanitoba.ca