Skip to contents

fg_append_code_info_to_longitudinal_data_sql

Usage

fg_append_code_info_to_longitudinal_data_sql(
  longitudinal_data_table,
  fg_codes_info_table,
  ICD10fi_map_to = "CODE1_CODE2",
  PURCH_map_to = "ATC",
  CANC_map_to = "MORPO_BEH_TOPO",
  REIMB_map_to = "REIMB",
  ICD10fi_precision = 5,
  ICD9fi_precision = 5,
  ICD8fi_precision = 5,
  ATC_precision = 7,
  NCSPfi_precision = 5,
  new_colums_sufix = ""
)

Arguments

longitudinal_data_table

full path to the table in longitudinal_data format

fg_codes_info_table

full path to the table with the codes info

ICD10fi_map_to

In INPAT, OUTPAT, PRIM_OUT, DEATH registers the ICD10fi combination codes are split into CODE1, CODE2 and CODE3. This parameter selects to what code or combination of codes to map to. Options:

  • "CODE1_CODE2" : appends info for the combined CODE1 and CODE2. e.g N0839*E112 (default).

  • "CODE1" : appends info only for CODE1. e.g N0839

  • "CODE2" : appends info only for CODE2. e.g E112

  • "ATC" : appends info only for ATC code in CODE3 column. e.g N02BE01

PURCH_map_to

In PURCH register rows contain the VNR code in CODE2 column and the ATC group in CODE1. This parameter selects to what of these two codes to append the info.

  • "ATC" : appends info for the ATC code in CODE1 column. e.g. N02BE01 (default).

  • "REIMB" : appends info for the REIMB code in CODE2 column. e.g. 205

  • "VNR" : appends info for the VNR code in CODE3 column. e.g. 003121

CANC_map_to

In CANC register the ICDO3 codes are split into CODE1, CODE2 and CODE3. This parameter selects to what code or combination of codes to map to.

  • "MORPO_BEH_TOPO" : appends info for the combined CODE1, CODE2 and CODE3. e.g. 8140/3-C61.9 (default).

  • "TOPO" : appends info for the TOPO code in CODE1 column. e.g. C61.9

  • "MORPO_BEH" : appends info for the MORPHO code in CODE2 column. e.g. 8140/3

REIMB_map_to

in REIMB register rows contain the REIMB code and, after 1995, also the ICD code that leaded to reimbursement. This selects to what of these two codes to map.

  • "REIMB" : appends info for the REIMB code in CODE1 column (default).

  • "ICD" : appends info for the ICD in CODE1 column

ICD10fi_precision

Number or leading codes in ICD10fi to map to. e.g. N0839 with ICD10fi_precision=3 is N08 (default = 5)

ICD9fi_precision

Number or leading codes in ICD9fi to map to. e.g. 8450B with ICD9fi_precision=3 is 845 (default = 5)

ICD8fi_precision

Number or leading codes in ICD8fi to map to. e.g. 36809 with ICD8fi_precision=3 is 368 (default = 5)

ATC_precision

Number or leading codes in ATC to map to. e.g. N02BE01 with ATC_precision=3 is N02 (default = 7)

NCSPfi_precision

Number or leading codes in NOMESCO to map to. e.g. AB1CB with NCSPfi_precision=2 is AB (default = 5)

new_colums_sufix

string indicating a prefix to add to the appended columns, default="".

Value

sql script ready to be ran