/* TUTORIAL PNRCHECK Author: Nicola Orsini - IMM, KI Date: 2004/03/31 */ net install http://nicolaorsini.altervista.org/stata/pnrcheck which pnrcheck // Case 1 - The storage type of the pnr variable is string of 10 digits clear set obs 1 gen str10 pnr = "3103170993" pnrcheck pnr, di savep(pnrright) listw d l, sep(0) // Case 2 - The storage type of the pnr variable is string of 12 digits clear set obs 1 gen str12 pnr = "193103170993" pnrcheck pnr, di savep(pnrright) listw d l, sep(0) // Case 3 - The storage type of the pnr variable is string of 11 digits clear set obs 1 gen str11 pnr = "310317-0993" pnrcheck pnr, di savep(pnrright) listw d l, sep(0) // Case 4 - The storage type of the pnr variable is string of 13 digits clear set obs 1 gen str13 pnr = "19310317-0993" pnrcheck pnr, di savep(pnrright) listw d l, sep(0) // Case 5 or 6 - The storage type of the pnr variable is numeric with double accuracy insheet using http://nicolaorsini.altervista.org/stata/tutorial/p/ex_pnrs.txt, clear describe list , sep(0) format pnr %12.0f list , sep(0) pnrcheck pnr pnrcheck pnr, di pnrcheck pnr, di listw pnrcheck pnr, savep(pnrright) savei(indvar) describe list , sep(0) // Remarks - The storage type of the pnr variable cannot be float clear set obs 1 gen float pnr = 3103170993 pnrcheck pnr, di savep(pnrright) listw d l, sep(0)