Create an id using name and dob
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | * Create an id using name and date of birth. * Ray SPSSX-L 2003/01/09. DATA LIST LIST /lastname firstnam (2A15) dob(SDATE). BEGIN DATA Smith John 2000/1/1 Raffe Sydelle 2001/7/7 Poppins Marry . Doe Art 2001/8/17 END DATA. LIST. STRING id(A18). COMPUTE id=CONCAT( SUBSTR(lastname,1,4), SUBSTR(firstnam,1,4), STRING(dob,ADATE10) ). * If want to remove the two "/". LOOP IF INDEX(id,"/")>0. COMPUTE id=CONCAT(SUBSTR(id,1,INDEX(id,"/")-1),SUBSTR(id,INDEX(id,"/")+1)). END LOOP. LIST id. * This is the output: ID SmitJohn01012000 RaffSyde07072001 PoppMarr . Doe Art 08172001 |
Related pages
...