**************************************************************************************************** * PROGRAM OVERVIEW **************************************************************************************************** * * PROGRAM: ms_loopmeds.sas * * Created (mm/dd/yyyy): 07/31/2014 * Last modified:07/07/2017 * Version: 1.1 * *-------------------------------------------------------------------------------------------------- * PURPOSE: * This program will extract medical claims using code CodeType CodeCat EncType and Pdx. This * macro is very similar to ms_extractmeds. For clarity purpose and because of the * wildcards handle for EncType and Pdx, both macros were kept as separate macros. * * Program inputs: * -dataset containing the raw claims * -dataset containing the lookup parameters * * Program outputs: * -dataset with the extracted claims * * PARAMETERS: * -datafile = Name of the dataset containing the raw claims * -lookfile = Name of the dataset containing the lookup parameters * -outfile = Name of the dataset with the extracted claims * * Programming Notes: * -This loop meds will support wilcard for Caresetting and Principal as created * by the macro ms_caresettingprincipal * * *-------------------------------------------------------------------------------------------------- * CONTACT INFO: * Mini-Sentinel Coordinating Center * info@mini-sentinel.org * *-------------------------------------------------------------------------------------------------- * CHANGE LOG: * * Version Date Initials Comment (reference external documentation when available) * ------- -------- -------- --------------------------------------------------------------- * 1.1 07/07/17 AP Modified length of variable codetype * ***************************************************************************************************; %MACRO ms_loopmeds(datafile=, lookfile=, outfile=); %put =====> MACRO CALLED: ms_loopmeds v1.1; %ISDATA(dataset=&lookfile.); %IF %EVAL(&NOBS.>=1) %THEN %DO; proc sql noprint; create table &outfile. as select claim.PatId, claim.Adate length 4 format date9., Codes.* from &datafile. as claim, &lookfile. as codes where codes.code = claim.code and codes.CodeType = claim.CodeType and codes.CodeCat = claim.CodeCat and ((codes.EncType = claim.EncType and codes.Pdx = claim.Pdx) or /*No Wilcards*/ (codes.EncType = "**" and codes.Pdx = claim.Pdx) or /*Any EncType*/ (codes.EncType = claim.EncType and codes.Pdx = "*") or /*Any Pdx*/ (codes.EncType = "**" and codes.Pdx = "*")); quit; %END; %ELSE %DO; data &outfile.; length codetype $3.; set &datafile.(obs=0) &lookfile.(obs=0 drop=code); run; %END; %put NOTE: ********END OF MACRO: ms_loopmeds v1.1********; %MEND ms_loopmeds;