**************************************************************************************************** * PROGRAM OVERVIEW **************************************************************************************************** * * PROGRAM: create_qrp_lookup_files.sas * * Created (mm/dd/yyyy): 02/08/2019 * Last modified: 12/04/2024 * Version: 1.13.0 * *-------------------------------------------------------------------------------------------------- * PURPOSE: * This program will create/update the following lookup tables to accompany QRP * - drugclass.sas7bdat * - labscodesmap.sas7bdat * - zipfile.sas7bdat * - pregnancycodes.sas7bdat * - pregnancymeta.sas7bdat * - pregnancyduration.sas7bdat * - riskscorecodes.sas7bdat * - icd10icd9map.sas7bdat * - icd10_child_parent.sas7bdat * - icd9_child_parent.sas7bdat * - mlccs_child_parent.sas7bdat * - congenital_malformation_tree * - sentinel_logo.jpg * * Program inputs: * - path for request folder * - path for location of FDB drug_ndc_summary.sas7bdat dataset * - path for location of MCM dx_icd10_full_lookup.sas7bdat dataset * - user defined ICD10 Tree ICD10TREEFILE * - user defined Exclusion file ICD10EXCLUDEFILE * - user defined riskscorecodes_ndc_lookup.sas7bdat dataset to update riskscorecodes RX codes * - user congenital_malformation_tree.sas7bdat * * * Program outputs: * * Programming Notes: * * *-------------------------------------------------------------------------------------------------- * CONTACT INFO: * Sentinel Coordinating Center * info@sentinelsystem.org * *-------------------------------------------------------------------------------------------------- * CHANGE LOG: * * Version Date Initials Comment (reference external documentation when available) * ------- -------- -------- --------------------------------------------------------------- ***************************************************************************************************; /*----------------------------------------------------------------------------*/ /* NOTE: Request programmer defines parameters in this section */ /*----------------------------------------------------------------------------*/ /* Define request path */ %let PATH = ; /* Riskscorecodes RX codes update is optional. Set Y to create it, or N to omit. Default is N */ %let UpdateRiskscorecodesRX = N; /* Drugclass file creation is optional. Set Y to create it, or N to omit. Default is N */ %let CREATEDRUGFILE = N; /* Define path for location of FDB drug_ndc_summary.sas7bdat dataset */ /* Leave blank if CREATEDRUGFILE = N OR UpdateRiskscorecodesRX = N above */ %let FDBPATH = ; /* ICD10Tree file creation is optional. Set Y to create it, or N to omit. Default is N */ %let CreateICD10TreeFile = N; /* Define path for location of MCM dx_icd10_full_lookup.sas7bdat dataset */ /* Leave blank if CreateICD10TreeFile = N above */ %let ICD10Path = ; /* Define ICD10TREEFILE. This file is contained within inpufiles and is a user created tree file*/ /* Leave blank if using default tree*/ %let ICD10TreeFile =; /* Define ICD10EXCLUDEFILE. THis file is contained within the inputfiles and is an exclusion file*/ /* for the ICD10 tree. This file should contain node and level for exclusions*/ /* 1st column is string identity of node to be pruned at the level of the tree closest to the root (numerically lowest number) and 2nd column is the level of the tree where this node is expected.*/ /*Leave blank if not exclusions */ %let ICD10ExcludeFile = ; ************************************************************************************************* ******* END OF USER INPUT ****** ******* DO NOT EDIT BELOW THIS LINE ****** ******* (Consult with SOC or Sentinel team leader if you feel edits are required) ****** *************************************************************************************************; *------------------------------------------------------------------------------------------------- * Setup Environment *-------------------------------------------------------------------------------------------------; /*---------------------------------------------------------------------*/ /* NOTE: This is standard SOC environment setup code -- Do Not Edit */ /*---------------------------------------------------------------------*/ /* System options */ options nosymbolgen; options nomlogic ; options ls=100 nocenter ; options obs=MAX ; options msglevel=i ; options mprint mprintnest ; options errorcheck=strict errors=0 ; options merror serror ; options dkricond=error dkrocond=error mergenoby=warn; options dsoptions=nonote2err noquotelenmax ; options reuse=no ; options fullstimer ; options missing = .; options validvarname = v7; *------------------------------------------------------------------------------------------------- * Define all file paths; *-------------------------------------------------------------------------------------------------; *Include standard macros; %macro soc_clean_paths(paths,print_path)/parmbuff; %local j ln subpath temppath; %if %length(%superq(paths)) eq 0 %then %do; %put The parameter path must be non-missing. ; %abort cancel ; %end ; /* remove any double spaces in the paths list and replace with single space */ %let paths=%qsysfunc(translate(&paths,%str(/),%str(\))); %do j=1 %to %qsysfunc(countw(&paths.,%str( ))); %let subpath=%qscan(&paths,&j,%str( )); %let ln=%length(&subpath); %if %qsubstr(&subpath,&ln,1) ne %str(/) %then %do; %let subpath=&subpath./; %end; %let d_exist = %soc_dirExist(&subpath) ; %if &d_exist eq 0 %then %do ; %if &print_path. = 0 %then %do; %put Path does not exist; %end; %else %do; %put Path &subpath. does not exist; %end; %abort cancel; %end ; %let temppath=&temppath. &subpath.; %end; %let paths=%qleft(&temppath); &paths /* returns value to calling environment, like a function */ %mend soc_clean_paths; %macro soc_dirExist(dir) ; %if %length(&dir.) eq 0 %then %do ; %put The parameter dir must be non-missing. ; %abort cancel ; %end ; %local rc fileref return ; %let rc = %qsysfunc(filename(fileref,&dir.)) ; %let return = %qsysfunc(fexist(&fileref.)) ; &return /* returns value to calling enivornment, like a function */ %let rc = %qsysfunc(filename(fileref)) ; %mend soc_dirExist; %macro soc_quotepath(list); %local j d_exist path_ct path subpath temppath; %let list_ct=%qsysfunc(countw(&list,%str( ))); %do j=1 %to &list_ct.; %let subpath=%qscan(&list,&j,%str( )); %let d_exist = %soc_dirExist(&subpath) ; %if &d_exist eq 0 %then %do; %put Path &subpath does not exist; %abort cancel; %end; %let subpath="&subpath."; %let temppath=&temppath. &subpath.; %end; %let list=%qleft(&temppath); &list /* returns value to calling enivornment, like a function */ %mend soc_quotepath; %macro soc_lib(ref, paths, options=) ; %local libpaths; %if %length(&ref) eq 0 %then %do ; %put libref is blank ; %abort cancel ; %end ; %if %length(%superq(paths)) eq 0 %then %do ; %put SOC-NOTE: For libref &ref the path is blank, libname assignment skipped ; %end ; %let libpaths= %soc_quotepath(&paths) ; libname &ref. %unquote((&libpaths.)) &options.; %mend soc_lib; /* Define subdirectories */ %let path = %soc_clean_paths(&path.); %let DPLOCAL = &path.dplocal/ ; %let MSOC = &path.msoc/ ; %let INFOLDER = &path.inputfiles/ ; %let SASPROGRAMS = &path.sasprograms/ ; /* Assign libnames */ %soc_lib(dplocal, &DPLOCAL); %soc_lib(msoc, &MSOC); %soc_lib(infolder, &INFOLDER, options=%str(access=readonly)); /*----------------------------------------------------------------------------*/ /* Include macros */ /*----------------------------------------------------------------------------*/ %include "&INFOLDER.macros/createlookupfiles.sas"; %include "&INFOLDER.macros/drugclass_lookup.sas"; %include "&INFOLDER.macros/icd10tree_lookup.sas"; %include "&INFOLDER.macros/riskscorecodes_rx_update.sas"; %include "&INFOLDER.macros/utility_macros.sas"; /*----------------------------------------------------------------------------*/ /* Call %createlookupfiles */ /*----------------------------------------------------------------------------*/ %createlookupfiles();