DATA Step, Macro, Functions and more

No data showing in two of the output files

Reply
Contributor
Posts: 46

No data showing in two of the output files

000001 //BHBUSPLN JOB (F0000000,5853,AO), 'S.DESTA',MSGCLASS=X,                
000002 //        CLASS=1,REGION=0M,TIME=NOLIMIT,NOTIFY=A082633,                
000003 //        RESTART=JS010.SAS                                             
000004 //*******************************************************************   
000005 //** A080356.REFERRAL.SAS(BHAUTHS4)                                 *   
000006 //**  AD HOC TO PULL PERCENTAGE OF BH AUTHS THAT MATCH CLAIMS.      *   
000007 //**  MODIFIED JAN 2016 TO PULL ONLY FROM MMS.                      *   
000008 //*******************************************************************   
000009 //JS010 EXEC SAS,WORK='130000,70000',PARM=CAPSOUT                       
000010 //MMS      DD DSN=A082633.BH.MMS1.SASS,                                 
000011 //*  DISP=(,CATLG,CATLG),UNIT=CART,VOL=(,,,40)                          
000012 //   DISP=OLD                                                           
000013 //SYSIN   DD  *                                                         
000014  OPTIONS LS=250 NOCENTER PS=32000 NOLABEL MSGLEVEL=I MPRINT MLOGIC;     
000015                                                                         
000016  ****************************************************************;      
000017  **  JS010: MMS DATA EXTRACTION.  CHANGE DATES AS NEEDED.      **;      
000018  ****************************************************************;      
000019                                                                         
000020 PROC SQL;                                                               
000021    CONNECT TO DB2(SSID=DBR0);                                           
000022       EXECUTE(SET CURRENT DEGREE='ANY') BY DB2;                         
000023 CREATE TABLE MMS.DATA   AS SELECT * FROM CONNECTION TO DB2              
000024  (SELECT                                                                
000025     PIWD.MMS_AUTHRZTN.AUTHRZTN_2_NUM              AS AUTHNUM,           
000026     PIWD.MMS_AUTHRZTN.FIRST_OPEN_DT               AS CREATEDDATE,       
000027     PIWD.DMIS_REPORT.PARNT_DMIS_ID                AS PARENTDMIS,        
000028     PIWD.DMIS_REPORT.PARNT_DMIS_FAC_NM            AS PARENTDMISNAME,    
000029     PIWD.MMS_AUTHRZD_MBR.SPNSR_STUS_CD            AS SPONSTAT,          
000030     PIWD.MMS_AUTHRZD_MBR.BENE_ROLE_CD             AS RELAT,             
000031     PIWD.MMS_AUTHRZD_SRVC.AUTHRZD_STRTG_PRCDR_CD  AS STARTCODE,         
000032     PIWD.MMS_AUTHRZD_SRVC.AUTHRZD_ENDG_PRCDR_CD   AS ENDCODE,           
000033     PIWD.MMS_AUTHRZD_SRVC.AUTHRZTN_LTR_SPCLTY_DESC AS SPECIALTY,        
000034     PIWD.MMS_AUTHRZD_MBR.SPNSR_SSN                AS SPONSORSSN,        
000035     PIWD.MMS_AUTHRZD_MBR.LAST_NAME                AS LASTNAME,          
000036     PIWD.MMS_AUTHRZD_MBR.FIRST_NAME               AS FIRSTNAME,         
000037     PIWD.MMS_AUTHRZD_MBR.ADR_LINE_1_NAME          AS ADDRESS,           
000038     PIWD.MMS_AUTHRZD_MBR.CITY_NAME                AS CITY,              
000039     PIWD.MMS_AUTHRZD_MBR.STATE_CD                 AS STATE,             
000040     PIWD.MMS_AUTHRZD_MBR.ZIP                      AS ZIP,               
000041     PIWD.MMS_AUTHRZD_MBR.SPNSR_RANK_CD            AS RANK,              
000042     PIWD.MMS_AUTHRZD_MBR.GNDR_CD                  AS GENDER,            
000043     A_ZAA_AUTHMEMBERZIP.AREA_NAME                 AS AREANAME,          
000044     PIWD.MMS_AUTHRZD_MBR.SPNSR_BRNCH_OF_SRVC_DESC AS BRANCH,            
000045     PIWD.MMS_AUTHRZD_MBR.BIRTH_DT                 AS BENEDOB,           
000046     PIWD.MMS_AUTHRZTN.PRMRY_DGNS_CD               AS DIAGCODE,          
000047     PIWD.MMS_AUTHRZTN.PRMRY_DGNS_DESC             AS DIAGDESC,          
000048     PIWD.MMS_AUTHRZTN.CASE_TYPE_CD                AS ACTION,            
000049     PIWD.MMS_AUTHRZD_SRVC.SRVC_CD                 AS SERVICECODE,       
000050     PIWD.MMS_AUTHRZTN.CLM_IND                     AS CLAIMIND           
000051   FROM                                                                  
000052     PIWD.ZIP_AREA_ASGNMT  A_ZAA_AUTHMEMBERZIP                           
000053      RIGHT OUTER JOIN PIWD.MMS_AUTHRZD_MBR ON                           
000054        (A_ZAA_AUTHMEMBERZIP.ZIP_CD                                      
000055          =PIWD.MMS_AUTHRZD_MBR.ZIP                                      
000056         AND CURRENT DATE BETWEEN A_ZAA_AUTHMEMBERZIP.EFCTV_DT           
000057               AND A_ZAA_AUTHMEMBERZIP.TRMNTN_DT)                        
000058      INNER JOIN PIWD.MMS_AUTHRZTN ON                                    
000059        (PIWD.MMS_AUTHRZD_MBR.AUTHRZTN_UNIQ_ID                           
000060          =PIWD.MMS_AUTHRZTN.AUTHRZTN_UNIQ_ID)                           
000061      INNER JOIN PIWD.MMS_AUTHRZD_SRVC ON                                
000062        (PIWD.MMS_AUTHRZTN.AUTHRZTN_UNIQ_ID                              
000063          =PIWD.MMS_AUTHRZD_SRVC.AUTHRZTN_UNIQ_ID)                       
000064      LEFT OUTER JOIN PIWD.MMS_AUTHRZD_PRVDR_SRVC_ASCTN ON               
000065        (PIWD.MMS_AUTHRZD_SRVC.AUTHRZD_SRVC_UNIQ_ID                      
000066          =PIWD.MMS_AUTHRZD_PRVDR_SRVC_ASCTN.AUTHRZD_SRVC_UNIQ_ID)       
000067      LEFT OUTER JOIN PIWD.DMIS_REPORT ON                                
000068        (PIWD.MMS_AUTHRZD_MBR.PCM_DMIS_ID                                
000069          =PIWD.DMIS_REPORT.DMIS_ID)                                     
000070   WHERE                                                                 
000071     (PIWD.MMS_AUTHRZTN.FIRST_OPEN_DT                                    
000072               BETWEEN '2016-09-01' AND '2016-11-30'                     
000073      AND PIWD.MMS_AUTHRZD_PRVDR_SRVC_ASCTN.AUTHRZD_PRVDR_TYPE_ID = 'A'  
000074      AND PIWD.MMS_AUTHRZD_SRVC.SRVC_STUS_CD NOT IN ('DN_S','DN_U')      
000075      AND PIWD.MMS_AUTHRZTN.AUTHRZTN_CLOSED_FLAG = 'Y'                   
000076      AND ((PIWD.MMS_AUTHRZTN.CASE_TYPE_CD = 'OPBH'                      
000077            AND (PIWD.MMS_AUTHRZD_SRVC.AUTHRZD_STRTG_PRCDR_CD            
000078                           BETWEEN '90801' AND '90802      '             
000079                 OR PIWD.MMS_AUTHRZD_SRVC.AUTHRZD_STRTG_PRCDR_CD         
000080                           BETWEEN '90804' AND '90857      '             
000081                 OR PIWD.MMS_AUTHRZD_SRVC.AUTHRZD_ENDG_PRCDR_CD          
000082                           BETWEEN '90801' AND '90802      '             
000083                 OR PIWD.MMS_AUTHRZD_SRVC.AUTHRZD_ENDG_PRCDR_CD          
000084                           BETWEEN '90804' AND '90857      '             
000085                )                                                        
000086           )                                                             
000087           OR PIWD.MMS_AUTHRZTN.CASE_TYPE_CD = 'IPBH'                    
000088           OR PIWD.MMS_AUTHRZD_SRVC.SRVC_CD LIKE 'BB%'                   
000089           OR PIWD.MMS_AUTHRZD_SRVC.AUTHRZD_ENDG_PRCDR_CD                
000090                           BETWEEN '0912' AND '0913       '              
000091          )                                                              
000092     )                                                                   
000093  );                                                                     
000094 %PUT &SQLXMSG &SQLXRC;                                                  
000095 QUIT;                                                                   
000096                                                                         
000097 //*******************************************************************   
000098 //JS020 EXEC SAS,WORK='130000,70000',PARM=CAPSOUT                       
000099 //MMS     DD DSN=A082633.BH.MMS1.SASS,DISP=SHR                          
000100 //OUT1  DD DSN=A082633.OUTPUT3A.TXT,                                    
000101 //*   DISP=(,CATLG,CATLG),UNIT=CART,VOL=(,,,40)                         
000102 //    DISP=OLD                                                          
000103 //OUT2  DD DSN=A082633.OUTPUT3B.TXT,                                    
 000104 //*   DISP=(,CATLG,CATLG),UNIT=CART,VOL=(,,,40)                         
 000105 //    DISP=OLD                                                          
 000106 //OUT3  DD DSN=A082633.OUTPUT3C.TXT,                                    
 000107 //*   DISP=(,CATLG,CATLG),UNIT=CART,VOL=(,,,40)                         
 000108 //    DISP=OLD                                                          
 000109 //OUT4  DD DSN=A082633.OUTPUT3D.TXT,                                    
 000110 //*   DISP=(,CATLG,CATLG),UNIT=CART,VOL=(,,,40)                         
 000111 //    DISP=OLD                                                          
 000112 //OUT5  DD DSN=A082633.OUTPUT3E.TXT,                                    
 000113 //*   DISP=(,CATLG,CATLG),UNIT=CART,VOL=(,,,40)                         
 000114 //    DISP=OLD                                                          
 000115 //OUT6  DD DSN=A082633.OUTPUT3F.TXT,                                    
 000116 //*   DISP=(,CATLG,CATLG),UNIT=CART,VOL=(,,,40)                         
 000117 //    DISP=OLD                                                          
 000118 //OUT7  DD DSN=A082633.OUTPUT3G.TXT,                                    
 000119 //*   DISP=(,CATLG,CATLG),UNIT=CART,VOL=(,,,40)                         
 000120 //    DISP=OLD                                                          
 000121 //OUT8  DD DSN=A082633.OUTPUT3H.TXT,                                    
 000122 //*   DISP=(,CATLG,CATLG),UNIT=CART,VOL=(,,,40)                         
 000123 //    DISP=OLD                                                          
 000124 //SORTWK01 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000125 //SORTWK02 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000126 //SORTWK03 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000127 //SORTWK04 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000128 //SORTWK05 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000129 //SORTWK06 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000130 //SORTWK07 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000131 //SORTWK08 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000132 //SORTWK09 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000133 //SORTWK10 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000134 //SORTWK11 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000135 //SORTWK12 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000136 //SORTWK13 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000137 //SORTWK14 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000138 //SORTWK15 DD UNIT=SORT,SPACE=(CYL,(900,750))                           
 000139 //SYSIN   DD  *                                                         
 000140  OPTIONS LS=250 NOCENTER PS=32000 NOLABEL MSGLEVEL=I MPRINT MLOGIC;     
 000141                                                                         
 000142  %INCLUDE 'FPCENRI.MACRO1.SAS(TILOUT1)'; * OUTPUT MACRO *;              
 000143                                                                         
 000144   PROC FREQ DATA=MMS.DATA;                                              
 000145     TABLES SERVICECODE;                                                 
 000146   RUN;                                                                  
 000147                                                                         
 000148  ***************************************************************;       
 000149  ** JS020: PROCESS AND OUTPUT DATA.                           **;       
 000150  ***************************************************************;       
 000151  ** PROCESS MMS DATA                                          **;       
 000152  ***************************************************************;       
 000153                                                                         
 000154   DATA MMS1 (DROP=SPONSTAT RELAT ACTION);                               
 000155    SET MMS.DATA;                                                        
000156     FORMAT BENECATEGORY $5. TYPE $25.     AGE 3.       ZIP $5.          
000157            FISCALMONTH 2.   FISCALYEAR 4. CREATEMONTH MONYY5. ;         
000158                                                                         
000159      IF TRIM(SPONSTAT) IN ('A', 'N', 'V', 'J') THEN DO;                 
000160        IF TRIM(RELAT) = 'BD' THEN BENECATEGORY = 'ADSM';                
000161        ELSE BENECATEGORY = 'ADFM';                                      
000162        END;                                                             
000163      ELSE DELETE;     ** DELETE NADFM DATA;                             
000164      IF MISSING(PARENTDMIS) THEN DELETE;                                
000165                                                                         
000166           IF SUBSTR(TRIM(SERVICECODE),1,2) = "BB"                       
000167                    THEN TYPE = "PARTIAL HOSPITALIZATION";               
000168      ELSE IF (SUBSTR(TRIM(SERVICECODE),1,2) = "BH"                      
000169               AND (TRIM(STARTCODE) IN ('0912','0913')                   
000170                    OR TRIM(ENDCODE) IN ('0912','0913')                  
000171                   )                                                     
000172              )                                                          
000173                    THEN TYPE = "OPOID REPLACEMENT THERAPY";             
000174      ELSE IF TRIM(ACTION) = "IPBH"                                      
000175                    THEN TYPE = "INPATIENT";                             
000176      ELSE IF (TRIM(STARTCODE) IN ('90801','90802')                      
000177               OR TRIM(ENDCODE) IN ('90801','90802')                     
000178               OR (TRIM(STARTCODE) >= '90804'                            
000179                   AND TRIM(STARTCODE) <= '90857')                       
000180               OR (TRIM(ENDCODE) >= '90804'                              
000181                   AND TRIM(ENDCODE) <= '90857')                         
000182              ) THEN TYPE = "OUTPATIENT";                                
000183      ELSE DELETE;                                                       
000184                                                                         
000185      IF MONTH(CREATEDDATE)>9                                            
000186         THEN DO;                                                        
000187             FISCALYEAR  = YEAR(CREATEDDATE)+1;                          
000188             FISCALMONTH = MOD(MONTH(CREATEDDATE)+3,12);                 
000189             CREATEMONTH = CREATEDDATE;                                  
000190             END;                                                        
000191      ELSE IF MOD(MONTH(CREATEDDATE)+3,12)>0                             
000192       THEN DO;                                                          
000193           FISCALYEAR  = YEAR(CREATEDDATE);                              
000194           FISCALMONTH = MOD(MONTH(CREATEDDATE)+3,12);                   
000195           CREATEMONTH = CREATEDDATE;                                    
000196           END;                                                          
000197      ELSE DO;                                                           
000198             FISCALYEAR  = YEAR(CREATEDDATE);                            
000199             FISCALMONTH = 12;                                           
000200             CREATEMONTH = CREATEDDATE;                                  
000201             END;                                                        
000202      AGE = (CREATEDDATE - BENEDOB)/365.25;                              
000203      LASTNAME = UPCASE(LASTNAME);                                       
000204      FIRSTNAME = UPCASE(FIRSTNAME);                                     
000205      ADDRESS = UPCASE(ADDRESS);                                         
000206      ZIP = SUBSTR(ZIP,1,5);                                             
000207      IF UPCASE(SUBSTR(BRANCH,1,38)) =                                   
000208         "THE COMMISSIONED CORPS OF THE PUBLIC H"                        
000209         THEN BRANCH = "PUBLIC HEALTH";                                  
000210      ELSE IF UPCASE(SUBSTR(BRANCH,1,38)) =                              
000211         "THE COMMISSIONED CORPS OF THE NATIONAL"                        
000212         THEN BRANCH = "NOAA";                                           
000213       ELSE BRANCH = TRIM(UPCASE(COMPRESS(BRANCH,,"P")));                
000214                       ** REMOVE COMMAS AND TRAILING SPACES ;            
000215                                                                         
000216      IF TRIM(CLAIMIND) = "Y" THEN DO;                                   
000217                               NOMATCH = 0;                              
000218                               MATCH   = 1;                              
000219                               END;                                      
000220                             ELSE DO;                                    
000221                               NOMATCH = 1;                              
000222                               MATCH   = 0;                              
000223                               END;                                      
000224      TOTALMATCHNOMATCH = MATCH + NOMATCH;                               
000225                                                                         
000226   RUN;                                                                  
000227                                                                         
000228   *** UNDUPLICATED MMS DATA ***;                                        
000229   PROC SORT DATA=MMS1 OUT=MMS NODUPKEY;                                 
000230     BY AUTHNUM;                                                         
000231   RUN;                                                                  
000232                                                                         
000233   PROC FREQ DATA=MMS;                                                   
000234     TABLES BRANCH                                                       
000235            STARTCODE*TYPE ;                                             
000236     TITLE 'STARTING CODES IN MMS';                                      
000237   RUN;                                                                  
000238                                                                         
000239    **TESTING **;                                                        
000240    PROC SUMMARY NWAY MISSING DATA=MMS;                                  
000241      CLASS TYPE CLAIMIND;                                               
000242      VAR   TOTALMATCHNOMATCH MATCH NOMATCH;                             
000243    OUTPUT OUT=TEST SUM=;                                                
000244    PROC PRINT DATA=TEST; TITLE 'OUTPATIENT TOTALS'; RUN;                
000245                                                                         
000246  ***************************************************************;       
000247  ** SUMMARY REPORTS.                                          **;       
000248  ***************************************************************;       
000249                                                                         
000250   PROC SUMMARY NWAY MISSING DATA=MMS;                                   
000251    CLASS TYPE                                                           
000252          FISCALYEAR                                                     
000253          FISCALMONTH                                                    
000254          CREATEMONTH                                                    
000255          PARENTDMIS                                                     
000256          PARENTDMISNAME                                                 
000257          BENECATEGORY;                                                  
000258    VAR   TOTALMATCHNOMATCH                                              
000259          MATCH                                                          
000260          NOMATCH ;                                                      
000261    OUTPUT OUT=SUMMARY1 SUM=;                                            
000262                                                                         
000263    DATA SUMMARYIN  (DROP=TYPE _TYPE_ _FREQ_)                            
000264         SUMMARYPH  (DROP=TYPE _TYPE_ _FREQ_)                            
000265         SUMMARYOP  (DROP=TYPE _TYPE_ _FREQ_)                            
000266         SUMMARYOUT (DROP=TYPE _TYPE_ _FREQ_);                           
000267      SET SUMMARY1;                                                      
000268           IF TRIM(TYPE) = "INPATIENT"                                   
000269                    THEN OUTPUT SUMMARYIN;                               
000270      ELSE IF TRIM(TYPE) = "PARTIAL HOSPITALIZATION"                     
000271                    THEN OUTPUT SUMMARYPH;                               
000272      ELSE IF TRIM(TYPE) = "OPOID REPLACEMENT THERAPY"                   
000273                    THEN OUTPUT SUMMARYOP;                               
000274      ELSE IF TRIM(TYPE) = "OUTPATIENT"                                  
000275                    THEN OUTPUT SUMMARYOUT;                              
000276    RUN;                                                                 
000277                                                                         
000278    %TILOUT1(SUMMARYIN, OUT1); **OUTPUT3A * INPATIENT SUMMARY         *; 
000279    %TILOUT1(SUMMARYPH, OUT2); **OUTPUT3B * PARTIAL HOSP SUMMARY      *; 
000280    %TILOUT1(SUMMARYOP, OUT3); **OUTPUT3C * OPOID REPLACEMENT SUMMARY *; 
000281    %TILOUT1(SUMMARYOUT,OUT4); **OUTPUT3D * OUTPATIENT SUMMARY        *; 
000282                                                                         
000283  ***************************************************************;       
000284  ** DETAIL REPORTS.                                           **;       
000285  ***************************************************************;       
 000286                                                                    
 000287   PROC SUMMARY NWAY MISSING DATA=MMS;                              
 000288    CLASS TYPE                                                      
 000289          FISCALYEAR                                                
 000290          FISCALMONTH                                               
 000291          CREATEMONTH                                               
 000292          PARENTDMIS                                                
 000293          PARENTDMISNAME                                            
 000294          AREANAME                                                  
 000295          SPONSORSSN                                                
 000296          LASTNAME                                                  
 000297          FIRSTNAME                                                 
 000298          ADDRESS                                                   
 000299          CITY                                                      
 000300          STATE                                                     
 000301          ZIP                                                       
 000302          BENECATEGORY                                              
 000303          RANK                                                      
 000304          BRANCH                                                    
 000305          GENDER                                                    
 000306          AGE                                                       
 000307          SPECIALTY                                                 
 000308          DIAGCODE                                                  
 000309          DIAGDESC                                                  
 000310          AUTHNUM;                                                  
 000311    VAR   MATCH ;                                                   
 000312    OUTPUT OUT=DETAIL1 SUM=;                                             
 000313                                                                         
 000314   DATA DETAILIN  (DROP=MATCH TYPE _TYPE_ _FREQ_)                        
 000315        DETAILPH  (DROP=MATCH TYPE _TYPE_ _FREQ_)                        
 000316        DETAILOP  (DROP=MATCH TYPE _TYPE_ _FREQ_)                        
 000317        DETAILOUT (DROP=MATCH TYPE _TYPE_ _FREQ_);                       
 000318    SET DETAIL1 ;                                                        
 000319                                                                         
 000320    SPECIALTY = TRIM(UPCASE(SPECIALTY));                                 
 000321    DIAGDESC  = TRIM(UPCASE(DIAGDESC));                                  
 000322                                                                         
 000323    IF MATCH >0 THEN CLAIM = "YES";                                      
 000324                ELSE CLAIM = "NO ";                                      
 000325           IF TRIM(TYPE) = "INPATIENT"                                   
 000326                    THEN OUTPUT DETAILIN;                                
 000327      ELSE IF TRIM(TYPE) = "PARTIAL HOSPITALIZATION"                     
 000328                    THEN OUTPUT DETAILPH;                                
 000329      ELSE IF TRIM(TYPE) = "OPOID REPLACEMENT THERAPY"                   
 000330                    THEN OUTPUT DETAILOP;                                
 000331      ELSE IF TRIM(TYPE) = "OUTPATIENT"                                  
 000332                    THEN OUTPUT DETAILOUT;                               
 000333    RUN;                                                                 
 000334                                                                         
 000335    %TILOUT1(DETAILIN, OUT5);  **OUTPUT3E * INPATIENT DETAIL         **; 
 000336    %TILOUT1(DETAILPH, OUT6);  **OUTPUT3F * PARTIAL HOSP DETAIL      **; 
 000337    %TILOUT1(DETAILOP, OUT7);  **OUTPUT3G * OPOID REPLACEMENT DETAIL **; 
000338    %TILOUT1(DETAILOUT,OUT8);  **OUTPUT3H * OUTPATIENT DETAIL        **; 
000339                                                                         
000340  ENDSAS;                                                                
000341                                                                         
****** **************************** Bottom of Data ****************************

 

Output 3c and Output 3G returned no data, but I can't figure out why.  Please help!

Super User
Posts: 11,343

Re: No data showing in two of the output files

Do you have a log? That should indicate where a data set was created with zero records. You may want to run the job with

Options MPRINT;

to get more details about behavior within the macros.

Contributor
Posts: 46

Re: No data showing in two of the output files: Log

1           OPTIONS LS=250 NOCENTER PS=32000 NOLABEL MSGLEVEL=I MPRINT MLOGIC;  
2                                                                               
3           %INCLUDE 'FPCENRI.MACRO1.SAS(TILOUT1)'; * OUTPUT MACRO *;           
NOTE: FORMAT $RISKIND HAS BEEN OUTPUT.                                          
                                                                                
NOTE: THE PROCEDURE FORMAT USED 0.00 CPU SECONDS AND 13424K.                    
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 13852K ABO
                                                                                
                                                                                
NOTE: FORMAT $CATIND HAS BEEN OUTPUT.                                           
                                                                                
NOTE: THE PROCEDURE FORMAT USED 0.00 CPU SECONDS AND 13424K.                    
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 13852K ABO
                                                                                
                                                                                
NOTE: FORMAT $STATEMD HAS BEEN OUTPUT.                                          
                                                                                
NOTE: THE PROCEDURE FORMAT USED 0.00 CPU SECONDS AND 13424K.                    
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 13852K ABO
                                                                                
                                                                                
NOTE: FORMAT $STATE HAS BEEN OUTPUT.                                            
                                                                                
NOTE: THE PROCEDURE FORMAT USED 0.00 CPU SECONDS AND 13424K.                    
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 13852K ABO
                                                                                
                                                                                
NOTE: FORMAT $SPSPEC HAS BEEN OUTPUT.                                           
                                                                                
NOTE: THE PROCEDURE FORMAT USED 0.00 CPU SECONDS AND 13424K.                    
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 13852K ABO
                                                                                
                                                                                
NOTE: FORMAT $DMIS HAS BEEN OUTPUT.                                             
                                                                                
NOTE: THE PROCEDURE FORMAT USED 0.08 CPU SECONDS AND 13808K.                    
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 14236K ABO
                                                                                
                                                                                
NOTE: FORMAT $SPECBOB HAS BEEN OUTPUT.                                          
                                                                                
NOTE: THE PROCEDURE FORMAT USED 0.00 CPU SECONDS AND 13808K.                    
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 14236K ABO
                                                                                
                                                                                
NOTE: FORMAT $SPECCAT HAS BEEN OUTPUT.                                          
                                                                                
NOTE: THE PROCEDURE FORMAT USED 0.00 CPU SECONDS AND 13808K.                    
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 14236K ABO
                                                                                
                                                                                
NOTE: FORMAT $PSA HAS BEEN OUTPUT.                                              
                                                                                
NOTE: THE PROCEDURE FORMAT USED 0.00 CPU SECONDS AND 13808K.                    
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 14236K ABO
                                                                                
                                                                                
NOTE: FORMAT $MA HAS BEEN OUTPUT.                                               
                                                                                
NOTE: THE PROCEDURE FORMAT USED 0.00 CPU SECONDS AND 13808K.                    
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 14236K ABO
                                                                                
                                                                                
NOTE: FORMAT $PROVSPE HAS BEEN OUTPUT.                                          
                                                                                
NOTE: THE PROCEDURE FORMAT USED 0.00 CPU SECONDS AND 13808K.                    
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 14236K ABO
                                                                                
                                                                                
NOTE: FORMAT $REIMBMT HAS BEEN OUTPUT.                                          
                                                                                
NOTE: THE PROCEDURE FORMAT USED 0.00 CPU SECONDS AND 14320K.                    
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 14748K ABO
                                                                                
                                                                                
NOTE: FORMAT $INPOUTP HAS BEEN OUTPUT.                                          
                                                                                
NOTE: THE PROCEDURE FORMAT USED 0.00 CPU SECONDS AND 14320K.                    
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 14748K ABO
                                                                                
                                                                                
NOTE: FORMAT $TOS HAS BEEN OUTPUT.                                              
                                                                                
NOTE: THE PROCEDURE FORMAT USED 0.00 CPU SECONDS AND 14320K.                    
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 14748K ABO
                                                                                
                                                                                
3962                                                                            
3963         PROC FREQ DATA=MMS.DATA;                                           
3964           TABLES SERVICECODE;                                              
3965         RUN;                                                               
                                                                                
NOTE: THERE WERE 38568 OBSERVATIONS READ FROM THE DATA SET MMS.DATA.            
NOTE: THE PROCEDURE FREQ PRINTED PAGE 1.                                        
NOTE: THE PROCEDURE FREQ USED 0.06 CPU SECONDS AND 15241K.                      
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 15676K ABO
                                                                                
                                                                                
3966                                                                            
3967        ***************************************************************;    
3968        ** JS020: PROCESS AND OUTPUT DATA.                           **;    
3969        ***************************************************************;    
3970        ** PROCESS MMS DATA                                          **;    
3971        ***************************************************************;    
3972                                                                            
3973         DATA MMS1 (DROP=SPONSTAT RELAT ACTION);                            
3974          SET MMS.DATA;                                                     
3975           FORMAT BENECATEGORY $5. TYPE $25.     AGE 3.       ZIP $5.       
3976                  FISCALMONTH 2.   FISCALYEAR 4. CREATEMONTH MONYY5. ;      
3977                                                                            
3978            IF TRIM(SPONSTAT) IN ('A', 'N', 'V', 'J') THEN DO;              
3979              IF TRIM(RELAT) = 'BD' THEN BENECATEGORY = 'ADSM';             
3980              ELSE BENECATEGORY = 'ADFM';                                   
3981              END;                                                          
3982            ELSE DELETE;     ** DELETE NADFM DATA;                          
3983            IF MISSING(PARENTDMIS) THEN DELETE;                             
3984                                                                            
3985                 IF SUBSTR(TRIM(SERVICECODE),1,2) = "BB"                    
3986                          THEN TYPE = "PARTIAL HOSPITALIZATION";            
3987            ELSE IF (SUBSTR(TRIM(SERVICECODE),1,2) = "BH"                   
3988                     AND (TRIM(STARTCODE) IN ('0912','0913')                
3989                          OR TRIM(ENDCODE) IN ('0912','0913')               
3990                         )                                                  
3991                    )                                                       
3992                          THEN TYPE = "OPOID REPLACEMENT THERAPY";          
3993            ELSE IF TRIM(ACTION) = "IPBH"                                   
3994                          THEN TYPE = "INPATIENT";                          
3995            ELSE IF (TRIM(STARTCODE) IN ('90801','90802')                   
3996                     OR TRIM(ENDCODE) IN ('90801','90802')                  
3997                     OR (TRIM(STARTCODE) >= '90804'                         
3998                         AND TRIM(STARTCODE) <= '90857')                    
3999                     OR (TRIM(ENDCODE) >= '90804'                           
4000                         AND TRIM(ENDCODE) <= '90857')                      
4001                    ) THEN TYPE = "OUTPATIENT";                             
4002            ELSE DELETE;                                                    
4003                                                                            
4004            IF MONTH(CREATEDDATE)>9                                         
4005               THEN DO;                                                     
4006                   FISCALYEAR  = YEAR(CREATEDDATE)+1;                       
4007                   FISCALMONTH = MOD(MONTH(CREATEDDATE)+3,12);              
4008                   CREATEMONTH = CREATEDDATE;                               
4009                   END;                                                     
4010            ELSE IF MOD(MONTH(CREATEDDATE)+3,12)>0                          
4011             THEN DO;                                                       
4012                 FISCALYEAR  = YEAR(CREATEDDATE);                           
4013                 FISCALMONTH = MOD(MONTH(CREATEDDATE)+3,12);                
4014                 CREATEMONTH = CREATEDDATE;                                 
4015                 END;                                                       
4016            ELSE DO;                                                        
4017                   FISCALYEAR  = YEAR(CREATEDDATE);                         
4018                   FISCALMONTH = 12;                                        
4019                   CREATEMONTH = CREATEDDATE;                               
4020                   END;                                                     
4021            AGE = (CREATEDDATE - BENEDOB)/365.25;                           
4022            LASTNAME = UPCASE(LASTNAME);                                    
4023            FIRSTNAME = UPCASE(FIRSTNAME);                                  
4024            ADDRESS = UPCASE(ADDRESS);                                      
4025            ZIP = SUBSTR(ZIP,1,5);                                          
4026            IF UPCASE(SUBSTR(BRANCH,1,38)) =                                
4027               "THE COMMISSIONED CORPS OF THE PUBLIC H"                     
4028               THEN BRANCH = "PUBLIC HEALTH";                               
4029            ELSE IF UPCASE(SUBSTR(BRANCH,1,38)) =                           
4030               "THE COMMISSIONED CORPS OF THE NATIONAL"                     
4031               THEN BRANCH = "NOAA";                                        
4032             ELSE BRANCH = TRIM(UPCASE(COMPRESS(BRANCH,,"P")));             
4033                             ** REMOVE COMMAS AND TRAILING SPACES ;         
4034                                                                            
4035            IF TRIM(CLAIMIND) = "Y" THEN DO;                                
4036                                     NOMATCH = 0;                           
4037                                     MATCH   = 1;                           
4038                                     END;                                   
4039                                   ELSE DO;                                 
4040                                     NOMATCH = 1;                           
4041                                     MATCH   = 0;                           
4042                                     END;                                   
4043            TOTALMATCHNOMATCH = MATCH + NOMATCH;                            
4044                                                                            
4045         RUN;                                                               
                                                                                
NOTE: THERE WERE 38568 OBSERVATIONS READ FROM THE DATA SET MMS.DATA.            
NOTE: THE DATA SET WORK.MMS1 HAS 16149 OBSERVATIONS AND 32 VARIABLES.           
NOTE: THE DATA STATEMENT USED 0.25 CPU SECONDS AND 16600K.                      
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 636K BELOW THE LINE AND 17060K ABO
                                                                                
                                                                                
4046                                                                            
4047         *** UNDUPLICATED MMS DATA ***;                                     
4048         PROC SORT DATA=MMS1 OUT=MMS NODUPKEY;                              
4049           BY AUTHNUM;                                                      
4050         RUN;                                                               
                                                                                
NOTE: HOST SORT WAS USED.                                                       
NOTE: 1278 OBSERVATIONS WITH DUPLICATE KEY VALUES WERE DELETED.                 
NOTE: THERE WERE 16149 OBSERVATIONS READ FROM THE DATA SET WORK.MMS1.           
NOTE: THE DATA SET WORK.MMS HAS 14871 OBSERVATIONS AND 32 VARIABLES.            
NOTE: THE PROCEDURE SORT USED 0.09 CPU SECONDS AND 17343K.                      
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 1640K BELOW THE LINE AND 23904K AB
                                                                                
                                                                                
4051                                                                            
4052         PROC FREQ DATA=MMS;                                                
4053           TABLES BRANCH                                                    
4054                  STARTCODE*TYPE ;                                          
4055           TITLE 'STARTING CODES IN MMS';                                   
4056         RUN;                                                               
                                                                                
NOTE: THERE WERE 14871 OBSERVATIONS READ FROM THE DATA SET WORK.MMS.            
NOTE: THE PROCEDURE FREQ PRINTED PAGE 2.                                        
NOTE: THE PROCEDURE FREQ USED 0.02 CPU SECONDS AND 16891K.                      
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 1640K BELOW THE LINE AND 23904K AB
                                                                                
                                                                                
4057                                                                            
4058          **TESTING **;                                                     
4059          PROC SUMMARY NWAY MISSING DATA=MMS;                               
4060            CLASS TYPE CLAIMIND;                                            
4061            VAR   TOTALMATCHNOMATCH MATCH NOMATCH;                          
4062          OUTPUT OUT=TEST SUM=;                                             
                                                                                
NOTE: THERE WERE 14871 OBSERVATIONS READ FROM THE DATA SET WORK.MMS.            
NOTE: THE DATA SET WORK.TEST HAS 6 OBSERVATIONS AND 7 VARIABLES.                
NOTE: THE PROCEDURE SUMMARY USED 0.03 CPU SECONDS AND 17283K.                   
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 1640K BELOW THE LINE AND 23904K AB
                                                                                
                                                                                
4063          PROC PRINT DATA=TEST; TITLE 'OUTPATIENT TOTALS'; RUN;             
                                                                                
NOTE: THERE WERE 6 OBSERVATIONS READ FROM THE DATA SET WORK.TEST.               
NOTE: THE PROCEDURE PRINT PRINTED PAGE 3.                                       
NOTE: THE PROCEDURE PRINT USED 0.00 CPU SECONDS AND 19592K.                     
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 1640K BELOW THE LINE AND 23904K AB
                                                                                
                                                                                
4064                                                                            
4065        ***************************************************************;    
4066        ** SUMMARY REPORTS.                                          **;    
4067        ***************************************************************;    
4068                                                                            
4069         PROC SUMMARY NWAY MISSING DATA=MMS;                                
4070          CLASS TYPE                                                        
4071                FISCALYEAR                                                  
4072                FISCALMONTH                                                 
4073                CREATEMONTH                                                 
4074                PARENTDMIS                                                  
4075                PARENTDMISNAME                                              
4076                BENECATEGORY;                                               
4077          VAR   TOTALMATCHNOMATCH                                           
4078                MATCH                                                       
4079                NOMATCH ;                                                   
4080          OUTPUT OUT=SUMMARY1 SUM=;                                         
4081                                                                            
                                                                                
NOTE: THERE WERE 14871 OBSERVATIONS READ FROM THE DATA SET WORK.MMS.            
NOTE: THE DATA SET WORK.SUMMARY1 HAS 552 OBSERVATIONS AND 12 VARIABLES.         
NOTE: THE PROCEDURE SUMMARY USED 0.05 CPU SECONDS AND 17416K.                   
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 1640K BELOW THE LINE AND 23904K AB
                                                                                
                                                                                
4082          DATA SUMMARYIN  (DROP=TYPE _TYPE_ _FREQ_)                         
4083               SUMMARYPH  (DROP=TYPE _TYPE_ _FREQ_)                         
4084               SUMMARYOP  (DROP=TYPE _TYPE_ _FREQ_)                         
4085               SUMMARYOUT (DROP=TYPE _TYPE_ _FREQ_);                        
4086            SET SUMMARY1;                                                   
4087                 IF TRIM(TYPE) = "INPATIENT"                                
4088                          THEN OUTPUT SUMMARYIN;                            
4089            ELSE IF TRIM(TYPE) = "PARTIAL HOSPITALIZATION"                  
4090                          THEN OUTPUT SUMMARYPH;                            
4091            ELSE IF TRIM(TYPE) = "OPOID REPLACEMENT THERAPY"                
4092                          THEN OUTPUT SUMMARYOP;                            
4093            ELSE IF TRIM(TYPE) = "OUTPATIENT"                               
4094                          THEN OUTPUT SUMMARYOUT;                           
4095          RUN;                                                              
                                                                                
NOTE: THERE WERE 552 OBSERVATIONS READ FROM THE DATA SET WORK.SUMMARY1.         
NOTE: THE DATA SET WORK.SUMMARYIN HAS 176 OBSERVATIONS AND 9 VARIABLES.         
NOTE: THE DATA SET WORK.SUMMARYPH HAS 120 OBSERVATIONS AND 9 VARIABLES.         
NOTE: THE DATA SET WORK.SUMMARYOP HAS 0 OBSERVATIONS AND 9 VARIABLES.           
NOTE: THE DATA SET WORK.SUMMARYOUT HAS 256 OBSERVATIONS AND 9 VARIABLES.        
NOTE: THE DATA STATEMENT USED 0.01 CPU SECONDS AND 17032K.                      
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 1640K BELOW THE LINE AND 23904K AB
                                                                                
                                                                                
4096                                                                            
4097          %TILOUT1(SUMMARYIN, OUT1); **OUTPUT3A * INPATIENT SUMMARY         
MLOGIC(TILOUT1):  BEGINNING EXECUTION.                                          
MLOGIC(TILOUT1):  PARAMETER GDSN HAS VALUE SUMMARYIN                            
MLOGIC(TILOUT1):  PARAMETER GOUT HAS VALUE OUT1                                 
MPRINT(TILOUT1):   DATA DATASET1;                                               
MPRINT(TILOUT1):   SET SUMMARYIN;                                               
MPRINT(TILOUT1):   RUN;                                                         
                                                                                
NOTE: THERE WERE 176 OBSERVATIONS READ FROM THE DATA SET WORK.SUMMARYIN.        
NOTE: THE DATA SET WORK.DATASET1 HAS 176 OBSERVATIONS AND 9 VARIABLES.          
NOTE: THE DATA STATEMENT USED 0.00 CPU SECONDS AND 17032K.                      
                                                                                
NOTE: THE ADDRESS SPACE HAS USED A MAXIMUM OF 1640K BELOW THE LINE AND 23904K AB
                                                                                
                                                                                
Ask a Question
Discussion stats
  • 2 replies
  • 81 views
  • 0 likes
  • 2 in conversation