LIBNAME LIBRARY 'U:\Mortality and Causes of Deaths\COD 1997-2022 timeseries\MCOD2021_Transfer\SAS\';
LIBNAME OUT 'U:\Mortality and Causes of Deaths\COD 1997-2022 timeseries\MCOD2021_Transfer\SAS\';
PROC FORMAT LIBRARY=LIBRARY ;
  Value  V2_F
    1='Individual death'
    2='Stillbirth'
  ;
  Value  V3_F
    0='0'
    1='1'
    2='2'
    3='3'
    4='4'
    5='5'
    6='6'
    7='7'
    8='8'
    9='9'
    10='10'
    11='11'
    12='12'
    13='13'
    14='14'
    15='15'
    16='16'
    17='17'
    18='18'
    19='19'
    20='20'
    21='21'
    22='22'
    23='23'
    24='24'
    25='25'
    26='26'
    27='27'
    28='28'
    29='29'
    30='30'
    31='31'
    32='32'
    33='33'
    34='34'
    35='35'
    36='36'
    37='37'
    38='38'
    39='39'
    40='40'
    41='41'
    42='42'
    43='43'
    44='44'
    45='45'
    46='46'
    47='47'
    48='48'
    49='49'
    50='50'
    51='51'
    52='52'
    53='53'
    54='54'
    55='55'
    56='56'
    57='57'
    58='58'
    59='59'
    60='60'
    61='61'
    62='62'
    63='63'
    64='64'
    65='65'
    66='66'
    67='67'
    68='68'
    69='69'
    70='70'
    71='71'
    72='72'
    73='73'
    74='74'
    75='75'
    76='76'
    77='77'
    78='78'
    79='79'
    80='80'
    81='81'
    82='82'
    83='83'
    84='84'
    85='85'
    86='86'
    87='87'
    88='88'
    89='89'
    90='90'
    91='91'
    92='92'
    93='93'
    94='94'
    95='95'
    96='96'
    97='97'
    98='98'
    99='99'
    100='100'
    101='101'
    102='102'
    103='103'
    104='104'
    105='105'
    106='106'
    107='107'
    108='108'
    109='109'
    110='110'
    111='111'
    112='112'
    113='113'
    114='114'
    115='115'
    116='116'
    117='117'
    118='118'
    119='119'
    120='120'
    122='122'
  ;
  Value  V4_F
    1='Male'
    2='Female'
    3='Undeterminable'
    9='Unspecified'
  ;
  Value  V5_F
    1='Never married'
    2='Married'
    3='Widowed'
    4='Divorced'
    5='Not applicable'
    9='Unspecified'
  ;
  Value  V6_F
    1='Parent'
    2='Spouse'
    3='Child'
    5='Other'
    9='Unspecified'
  ;
  Value  V7_F
    0='None'
    1='Grade R'
    2='Sub A Gr 1'
    3='Sub B Gr 2'
    4='Std 1 Gr 3'
    5='Std 2 Gr 4'
    6='Std 3 Gr 5'
    7='Std 4 Gr 6'
    8='Std 5 Gr 7'
    9='Std 6 Gr 8'
    10='Std 7 Gr 9'
    11='Std 8 Gr 10    Form 3    NTC1'
    12='Std 9 Gr 11    Form 4    NTC2'
    13='Std 10 Gr 12    Form 5    NTC3'
    14='University / Technickon'
    97='Unknown'
    98='Not applicable'
    99='Unspecified'
  ;
  Value  V8_F
    0='Occupations unspecified and not elsewhere specified and not economically active persons'
    1='Managers'
    2='Professionals'
    3='Technicians and associate professionals'
    4='Clerical support workers'
    5='Service and sales workers and armed forces'
    6='Skilled agricultural and fishery workers'
    7='Craft and related trade workers'
    8='Plant and machine operators and assemblers'
    9='Elementary occupations'
    99='Unspecified'
  ;
  Value  V9_F
    0='Private household, exterritorial organisations, representatives of foreign governments & other activities not adequately defined'
    1='Agriculture, hunting, forestry and fishing'
    2='Mining and quarrying'
    3='Manufacturing'
    4='Electricity, gas and water supply'
    5='Construction'
    6='Wholesale and retail; repair of motor cycles and personal and household goods; hotels and restaurants'
    7='Transport storage and communication'
    8='Financial intermediation insurance, real estate and business services'
    9='Community, social and personal services'
    97='Unknown'
    98='Not applicable'
    99='Unspecified'
  ;
  Value  V10_F
    1='Yes'
    2='No'
    3='Do not know'
    4='Not applicable'
    9='Unspecified'
  ;
  Value  V11_F
    1='Yes'
    2='No'
    3='Unknown'
    9='Unspecified'
  ;
  Value  V12_F
    1='Black African'
    2='White'
    3='Indian or Asian'
    4='Coloured'
    5='Other'
    9='Unspecified'
  ;
  Value  V13_F
    1='South Africa'
    2='Zimbabwe'
    3='Swaziland'
    4='Botswana'
    5='Lesotho'
    6='Mozambique'
    7='Namibia'
    8='Mauritius'
    9='Angola'
    10='Zambia'
    11='Malawi'
    12='Tanzania'
    13='Madagascar'
    14='DRC'
    15='Other'
    97='Unknown'
    99='Unspecified'
  ;
  Value  V14_F
    1='Western Cape'
    2='Eastern Cape'
    3='Northern Cape'
    4='Free State'
    5='KwaZulu-Natal'
    6='North West'
    7='Gauteng'
    8='Mpumalanga'
    9='Limpopo'
    98='Outside South Africa'
    99='Unspecified'
  ;
  Value  V15_F
    1='Western Cape'
    2='Eastern Cape'
    3='Northern Cape'
    4='Free State'
    5='KwaZulu-Natal'
    6='North West'
    7='Gauteng'
    8='Mpumalanga'
    9='Limpopo'
    98='Outside South Africa'
    99='Unspecified'
  ;
  Value  V16_F
    1='Western Cape'
    2='Eastern Cape'
    3='Northern Cape'
    4='Free State'
    5='KwaZulu-Natal'
    6='North West'
    7='Gauteng'
    8='Mpumalanga'
    9='Limpopo'
    99='Unspecified'
  ;
  Value  V17_F
    1='Autopsy'
    2='Post mortem examination'
    3='Opinion of attending medical practitioner'
    4='Opinion of attending medical practitioner on duty'
    5='Opinion of registered professional nurse'
    6='Interview of family member'
    7='Other'
    8='Autopsy results may be available later'
    9='Autopsy not performed'
    98='Unknown'
    99='Unspecified'
  ;
  Value  V18_F
    1='Hospital'
    2='Emergency room/Outpatient'
    3='Dead on arrival'
    4='Nursing home'
    5='Home'
    6='Other'
    8='Unknown'
    9='Unspecified'
  ;
  Value  V19_F
    1='Natural underlying cause'
    2='Non-natural underlying cause'
  ;
  Value  V20_F
    500='500'
    501='501'
    502='502'
    505='505'
    506='506'
    509='509'
    510='510'
    515='515'
    520='520'
    524='524'
    525='525'
    530='530'
    535='535'
    540='540'
    542='542'
    543='543'
    545='545'
    550='550'
    552='552'
    555='555'
    558='558'
    560='560'
    565='565'
    570='570'
    575='575'
    580='580'
    585='585'
    590='590'
    595='595'
    600='600'
    5000='5000'
    5007='5007'
    5015='5015'
    5040='5040'
    5050='5050'
    5090='5090'
    5100='5100'
    5103='5103'
    5150='5150'
    5173='5173'
    5180='5180'
    5200='5200'
    5201='5201'
    5220='5220'
    5250='5250'
    5270='5270'
    5300='5300'
    5303='5303'
    5343='5343'
    5350='5350'
    5450='5450'
    5459='5459'
    5509='5509'
    5520='5520'
    5550='5550'
    5600='5600'
    5601='5601'
    5609='5609'
    5700='5700'
    5709='5709'
    5725='5725'
    5798='5798'
    5800='5800'
    5825='5825'
    5865='5865'
    5900='5900'
    5959='5959'
    6000='6000'
    9998='Not applicable (individual deaths, i.e. not stillborns)'
    9999='Unspecified'
  ;
RUN;
DATA  OUT.Deceased Details;
 INFILE 'U:\Mortality and Causes of Deaths\COD 1997-2022 timeseries\MCOD2021_Transfer\SAS\Deceased Details.dat' LRECL = 43;
 INPUT
  SerialNo $ 1-11  DeathType 12-12  AgeYear 13-15  Sex 16-16  MStatus 17-17  Relationship 18-18  EduCode 19-20  OccupationGrp 21-22  Industry 23-24  Smoker 25-25
  Pregnancy 26-26  PopGroup 27-27  Citizenship 28-29  BirthProvince 30-31  DeathProvince 32-33  ResProvince 34-35  Ascertainment 36-37  DeathInst 38-38  NaturalUnnatural 39-39  BirthWeight 40-43
 ;

  FORMAT  DeathType V2_F. ;
  FORMAT  AgeYear V3_F. ;
  FORMAT  Sex V4_F. ;
  FORMAT  MStatus V5_F. ;
  FORMAT  Relationship V6_F. ;
  FORMAT  EduCode V7_F. ;
  FORMAT  OccupationGrp V8_F. ;
  FORMAT  Industry V9_F. ;
  FORMAT  Smoker V10_F. ;
  FORMAT  Pregnancy V11_F. ;
  FORMAT  PopGroup V12_F. ;
  FORMAT  Citizenship V13_F. ;
  FORMAT  BirthProvince V14_F. ;
  FORMAT  DeathProvince V15_F. ;
  FORMAT  ResProvince V16_F. ;
  FORMAT  Ascertainment V17_F. ;
  FORMAT  DeathInst V18_F. ;
  FORMAT  NaturalUnnatural V19_F. ;
  FORMAT  BirthWeight V20_F. ;
  LABEL
    SerialNo='Serial number'
    DeathType='Death type (Individual death/Stillbirth)'
    AgeYear='Age in completed years'
    Sex='Sex of deceased'
    MStatus='Marital status of deceased'
    Relationship='Relationship of informant to deceased'
    EduCode='Education of deceased'
    OccupationGrp='Groups of occupation of deceased'
    Industry='Type of business / industry where the deceased was working'
    Smoker='Smoking status of deceased'
    Pregnancy='Pregnancy status of deceased'
    PopGroup='Population group'
    Citizenship='Citizenship of deceased'
    BirthProvince='Province of birth of the deceased'
    DeathProvince='Province of death occurrence'
    ResProvince='Province of usual residence of the deceased'
    Ascertainment='Ascertainment of the cause of death'
    DeathInst='Place of death'
    NaturalUnnatural='Natural/non-natural underlying causes of death'
    BirthWeight='Birth weight in grams'
  ;
  ;
RUN;
