[EpiData-list] numerical to date chk?

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Tue Sep 30 11:56:36 CDT 2008


How about something like this:

Check file:

BEFORE FILE
  DEFINE x1 ##
  DEFINE x2 ##
  DEFINE x3 ##
END

pid
  MUSTENTER
  AFTER ENTRY
*    one line might also do it 
*    LET d1 = Date(Integer(Copy(pid,1,1)), Integer(Copy(pid,3,2)),
Integer(Copy(pid,5,2)))
*
     x1 = Integer(Copy(pid,1,2))
     x2 = Integer(Copy(pid,3,2))
     x3 = Integer(Copy(pid,5,2))
     LET d1 = Date(x1, x2, x3)
  END
END

Date file structure:


DATA FILE:             C:\Documents and
Settings\Owner.YOUR-E92F6775CF\My Documents\_chp\pid2bd.rec
File label:            pid to birthdat

File size:             281 bytes
Last revision:         30. Sep 2008 12:48 PM
Number of fields:      2
Number of records:     6
Checks applied:        Yes (Last revision 30. Sep 2008 12:49 PM)


Fields in data file:

No. Name       Variable label        Field type      Width 
Checks             
--------------------------------------------------------------------------------
  1 pid                              Text            10     Must
enter         
                                                            More: See
check file

  2 d1                               Date (dmy)     
10                        

--------------------------------------------------------------------------------

and data:

2 1 VLAB Filelabel: pid to birthdat
_pid           1   1  30   7   1   1  10 112 pid  
_d1            1   3  30   7   3  11  10 112 d1   
240508abcd24/05/2008!
010105999901/01/2005!
230785cccc23/07/1985!
240589aaaa24/05/1989!
231286abcd23/12/1986!
170589abcd17/05/1989!


I use the identification as a string (pid).

Pete Geddes
geddes at ix.netcom.com


epidata-list at lists.umanitoba.ca wrote:
> Dear Epidata list,
> I am looking for a way to generate a date-variable from a
> numerical-variable.
>
> i.e. I will type in the Danish central person registration number (10
> digits where the 6 first digits are the birthday ddmmyy) I would like
> to automatically create a date variable from this - to calculate ages
> at later dates.
>
> I have looked for a chk that would do it, but couldn't find any.
> Does anybody have a solution?
> (and sorry if this has been discussed before, I searched and couldn't
> find any relevant discussion threads)
>
> thanks in advance,
> Drude Molbo,
> data admin
> dept. of social medicine, KU
> DK
> _______________________________________________
> EpiData-list mailing list
> EpiData-list at lists.umanitoba.ca
> http://lists.umanitoba.ca/mailman/listinfo/epidata-list
>
>


More information about the EpiData-list mailing list