DATA Step, Macro, Functions and more

Stuck on this one!

Reply
Contributor
Posts: 37

Stuck on this one!

4182          PROC SORT DATA=CLAIM1.DATA OUT=CLAIM2 NODUPKEY;        
4183             BY CLAIMBASEID CLAIMLINEID;                         
                 __                                                  
                 __                                                  
                 __                                                  
                 180                                                 
                 180                                                 
                 180                   
                                                                            
ERROR 180-322: Statement is not valid or it is used out of proper order.    
ERROR 180-322: Statement is not valid or it is used out of proper order.    
ERROR 180-322: Statement is not valid or it is used out of proper order.    
                                                                            
4184             RUN;                           
4186         ************************************************************;      
4187         * DEFINE OTHER VARIABLES NEEDED FOR REPORT                **;      
4188         ************************************************************;      
4189         %INCLUDE 'A080356.MACRO1.SAS(CLAIMS)'; * CLAIMS MACRO *;           
4696         DATA CLAIM2;                                                       
4697           SET CLAIM1;                                                      
ERROR: File WORK.CLAIM1.DATA does not exist.                                    
ERROR: File WORK.CLAIM1.DATA does not exist.                                    
ERROR: File WORK.CLAIM1.DATA does not exist.                                    
4698         &YEARMONTH;                                                        
WARNING: Character format specified for the result of a numeric expression.     
10                                                         The SAS System       
                                                                                
WARNING: Character format specified for the result of a numeric expression.     
WARNING: Character format specified for the result of a numeric expression.     
WARNING: Character format specified for the result of a numeric expression.     
4699         &AGECAT; **AGE RANGE**                                             
4700         FORMAT NETWORKCLMS NET.;                                           
4701         FORMAT PLACEOFSERVICE POS.;    
                                   48                                        
                                   48                                        
                                   48                                        
ERROR 48-59: The format POS was not found or could not be loaded.            
ERROR 48-59: The format POS was not found or could not be loaded.            
ERROR 48-59: The format POS was not found or could not be loaded.            
                                                                             
4702         FORMAT HOSPPROF HP.;                                            
                             ___                                             
                             ___                                             
                             ___                                             
                             48                                              
                             48                                              
                             48                                              
ERROR 48-59: The format HP was not found or could not be loaded.             
ERROR 48-59: The format HP was not found or could not be loaded.             
ERROR 48-59: The format HP was not found or could not be loaded.             
                                                                             
4703         &DIAGCHAP;                                                      
4704         &DIAGFORM;                                                      
4705         IF TRIM(CPTCODE) IN ('27438','27446','27447','27486','27487',   
4706         '27488','27445','27090','27091','27125','27130','27132',        
4707         '27134','27236','27137','27138','23472','23470','23473',        
4708         '23474','24363','24370','24371','25446','27702','27703',        
4709         '27704') THEN TYPE = "JOINT REPLACEMENT PROCEDURE";             
4710           ELSE IF DRGNUMBER IN                                          
4711               ('483','507','508','515','516','517','484','469','470')   
4712            OR DRGNUMBER BETWEEN ('466' AND '470') THEN TYPE =              
                             _______                                            
                             _______                                            
                             _______                                            
                             22                                                 
                             22                                                 
                             22                                                 
                             68                                                 
                             68                                                 
                             68                                                 
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, *, **, 
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, *, **, 
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, *, **, 
              GT, LE, LT, MAX, MIN, NE, NG, NL, OR, Ý, ¬=, {, |, ||, ~=.        
              GT, LE, LT, MAX, MIN, NE, NG, NL, OR, Ý, ¬=, {, |, ||, ~=.        
              GT, LE, LT, MAX, MIN, NE, NG, NL, OR, Ý, ¬=, {, |, ||, ~=.        
                                                                                
ERROR 68-185: The function BETWEEN is unknown, or cannot be accessed.           
ERROR 68-185: The function BETWEEN is unknown, or cannot be accessed.           
ERROR 68-185: The function BETWEEN is unknown, or cannot be accessed.         
Super User
Posts: 6,963

Re: Stuck on this one!

I guess the culprit for the first error is a statement that comes before log line 4182 that keeps the proc sort statement from being recognized as such.

 

Then you create CLAIM2 twice out of CLAIM1, which is not there at all. Maybe the step that should create CLAIM1 fails.

 

Next you seem to miss a lot of formats. Either you're missing the proc format that declares them, or the options fmtsearch= that defines the search path for them.

 

The BETWEEN operator only works in SQL, not in a data step.

Use

'466' <= DRGNUMBER <= '470'

instead

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 37

Re: Stuck on this one! (This is the full program)

[ Edited ]
000009 //JSDEL    EXEC PGM=IEFBR14                                             
000010 //JS010 EXEC SAS,WORK='90000,45000',                                    
000011 //      PARM=('SORT=4870 SORTPGM=BEST',                                 
000012 //       'MEMSIZE=0 SORTSIZE=MAX SORTWKNO=6 ERRORS=1')                  
000013 //*==================================================================*  
000014 //*                                                                     
000015 //CLMDATA  DD DSN=FMCSS.CLMS15M.T3.FEB0117.SASS,DISP=SHR                
000016 //*                                                                     
000017 //EPCLAIM1 DD DSN=A082633.EPCLAIM1.SASS,                                
000018 //*         DISP=(,CATLG,DELETE),UNIT=CART,VOL=(,,,40)                  
000019 //          DISP=OLD                                                    
000020 //SELECT1  DD DSN=A082633.SELECT1.SASS,                                 
000021 //*        DISP=(,CATLG,DELETE),UNIT=CART,VOL=(,,,40)                   
000022 //         DISP=OLD                                                     
000023 //SELECT2  DD DSN=A082633.SELECT2.SASS,                                 
000024 //          DISP=(,CATLG,DELETE),UNIT=CART,VOL=(,,,40)                  
000025 //*         DISP=OLD                                                    
000026 //SELECTA  DD DSN=A082633.SELECTA.SASS,                         
000027 //          DISP=(,CATLG,DELETE),UNIT=CART,VOL=(,,,200)         
000028 //*         DISP=OLD                                            
000029 //SELECT3  DD DSN=A082633.SELECT3.SASS,                         
000030 //          DISP=(,CATLG,DELETE),UNIT=CART,VOL=(,,,40)          
000031 //*         DISP=OLD                                            
000032 //SELECTB  DD DSN=A082633.SELECTB.SASS,                         
000033 //         DISP=(,CATLG,DELETE),UNIT=CART,VOL=(,,,200)          
000034 //*         DISP=OLD                                            
000035 //CLAIM1  DD DSN=A082633.CLAIM1.SASS,                           
000036 //*         DISP=(,CATLG,DELETE),UNIT=CART,VOL=(,,,40)          
000037 //          DISP=OLD                                            
000038 //CLAIM2  DD DSN=A082633.CLAIM2.SASS,                           
000039 //*         DISP=(,CATLG,DELETE),UNIT=CART,VOL=(,,,40)          
000040 //          DISP=OLD                                            
000041 //CLAIM3  DD DSN=A082633.CLAIM3.SASS,                           
000042 //*         DISP=(,CATLG,DELETE),UNIT=CART,VOL=(,,,40)          
000043 //          DISP=OLD                                            
000044 //OUT1  DD DSN=A082633.OUTPUT1A.TXT,                            
000045 //*         DISP=(,CATLG,DELETE),UNIT=CART,VOL=(,,,60)          
000046 //          DISP=OLD                                            
000047 //OUT2  DD DSN=A082633.OUTPUT1B.TXT,                            
000048 //*        DISP=(,CATLG,DELETE),UNIT=CART,VOL=(,,,60)           
000049 //          DISP=OLD                                            
000050 //OUT3  DD DSN=A082633.OUTPUT1C.TXT,                            
000051 //*         DISP=(,CATLG,DELETE),UNIT=CART,VOL=(,,,60)          
000052 //          DISP=OLD                                                    
000053 //OUT4  DD DSN=A082633.OUTPUT1D.TXT,                                    
000054 //*         DISP=(,CATLG,DELETE),UNIT=CART,VOL=(,,,60)                  
000055 //          DISP=OLD                                                    
000056 //*==================================================================*  
000057 //SYSIN     DD *                                                        
000058 ********************************************************************;   
000059 OPTIONS OBS=MAX LS=132 SORT=2000 SORTPGM=BEST NOSORTDEVWARN;            
000060                                                                         
000061   %INCLUDE 'FPCENRI.MACRO1.SAS(TILOUT1)'; * OUTPUT MACRO *;             
000062                                                                         
000063   ************************************************************;         
000064   * DEFINE SPECIFICATIONS                                   **;         
000065   ************************************************************;         
000066                                                                         
000067   %LET BEGDT = 01JAN2016 ; ** BEG. DOS FOR NUR                   ;      
000068   %LET ENDDT = 31DEC2016  ; ** END. DOS                           ;     
000069   %LET SPECLIST = ('20','T7');                                          
000070                                                                         
000071   PROC FORMAT;                                                          
000072      VALUE $PRIME 'PRIMECIV' = 'PRIME CIVILIAN'                         
000073                   'PRIMEMTF' = 'PRIME MTF';                             
000074      VALUE $NET   'I'        = 'NETWORK'                                
000075                   'O'        = 'NONNETWORK';                            
000076      VALUE $HP  '1'='HOSPITAL INPATIENT'                                
000077                 '2'='HOSPITAL OUTPATIENT MATERNITY'                     
000078                 '3'='HOSPITAL OUTPATIENT'                               
000079                 '4'='PROFESSIONAL INPATIENT'                            
000080                 '5'='PROFESSIONAL OUTPATIENT MATERNITY'                 
000081                 '6'='PROFESSIONAL OUTPATIENT'                           
000082                 '7'='AMBULATORY SURGERY FACILITY';                      
000083                                                                         
000084      VALUE $POS '0'='OTHER NOT CLASSIFIED'                              
000085                  '1'='INPATIENT HOSPITAL'                               
000086                  '2'='OUTPATIENT HOSPITAL'                              
000087                  '3'='PHYSICIANS OFFICE'                                
000088                  '4'='PATIENTS HOME'                                    
000089                  '5'='DAYCARE PSYCHIATRIC'                              
000090                  '6'='NIGHTCARE PSYCHIATRIC'                            
000091                  '7'='NURSING HOME DOMICILIARY'                         
000092                  '8'='SNF EXTENDED CARE'                                
000093                  '9'='AMBULANCE HOSPITAL'                               
000094                  'A'='INDEPENDENT LAB'                                  
000095                  'B'='OTHER MEDICAL SURGICAL FACILITY'                  
000096                  'C'='DENTAL'                                           
000097                  'D'='RESIDENTAL TREATMENT FACILITY'                    
000098                  'E'='OUTPATIENT TREATMENT FACILITY';                   
000099   RUN;                                                                  
000100                                                                         
000101  ************************************************************;          
000102  * EXTRACT ALL POTENTIAL EPISODE OF CARE CLAIMS            **;          
000103  ************************************************************;          
000104                                                                         
000105  DATA EPCLAIM1.DATA (KEEP=BENEID SPONSORPPI PATIENTID CLAIMBASEID       
000106                           CLAIMLINEID ADMITDATE CLMBEGINDATE            
000107                           CLMENDDATE DCDATE PROVAFFCLMS PROVAFFNAMECLMS 
000108                           SPECDESC ZIP5CLMS HOSPPROF CPTCODE            
000109                           AMTALLOWED AMTTOTALBILLED AMTPAIDPROV         
000110                           PROVTYPECLMS PROVSPEC BENECATEGORY            
000111                           NBRSVCS DIAGCODE MTFNUMBER ICDVERSIONIND      
000112                           REVCODE PLACEOFSERVICE NETWORKCLMS            
000113                           ENROLLSTATUS DRGNUMBER PATIENTDOB             
000114                           ENROLLPRIMECAT SPECCODE PTSEXRELCODE          
000115                   );                                                    
000116     SET CLMDATA.DATA;                                                   
000117     WHERE (                                                             
000118            CLMBEGINDATE >=  "&BEGDT"D                                   
000119            AND                                                          
000120            "&ENDDT"D >= CLMBEGINDATE                                    
000121           AND MTFNUMBER = '0056');                                      
000122  RUN;                                                                   
000123                                                                         
000124  PROC PRINT DATA=EPCLAIM1.DATA (OBS=100); RUN;                          
000125                                                                         
000126                                                                         
000127   ************************************************************;         
000128   * EXTRACT JOINT REPLACEMENT CLAIMS                         *;         
000129   * KNEE/HIP/SHOULDER/WRIST/ELBOW/ANKLE                       ;         
 000130   ************************************************************;         
 000131                                                                         
 000132  DATA JTREP (KEEP = BENEID CLMBEGINDATE CLMENDDATE CPTCODE              
 000133     AMTPAIDPROV );                                                      
 000134     SET EPCLAIM1.DATA;                                                  
 000135  WHERE ("&BEGDT"D  LE CLMBEGINDATE                                      
 000136          AND                                                            
 000137          CLMBEGINDATE LE "&ENDDT"D                                      
 000138          AND                                                            
 000139         (TRIM(CPTCODE) IN ('27438','27446','27447','27486','27487',     
 000140          '27488','27445','27090','27091','27125','27130','27132',       
 000141          '27134','27236','27137','27138','23472','23470','23473',       
 000142          '23474','24363','24370','24371','25446','27702','27703',       
 000143          '27704') OR DRGNUMBER IN ('466','467','468','469','470',       
 000144          '483','507','508','515','516','517','484')                     
 000145          ));                                                            
 000146                                                                         
 000147  RUN;                                                                   
 000148                                                                         
 000149  PROC PRINT DATA=JTREP (OBS=100); TITLE 'JTREP'; RUN;                   
 000150                                                                         
 000151  PROC SUMMARY NWAY MISSING DATA=JTREP;                                  
 000152   CLASS BENEID CLMBEGINDATE CPTCODE;                                    
 000153   VAR   AMTPAIDPROV;                                                    
 000154   OUTPUT OUT=JTREP1 SUM=;                                               
 000155  PROC PRINT DATA=JTREP1 (OBS=100); TITLE 'JTREP1'; RUN;                 
000156                                                                         
000157  ** HIGHEST COST PROCEDURE PER EPISODE FIRST **;                        
000158  PROC SORT DATA=JTREP1 OUT=JTREP2;                                      
000159    BY BENEID CLMBEGINDATE DESCENDING AMTPAIDPROV;                       
000160  RUN;                                                                   
000161                                                                         
000162  DATA JTREP (KEEP=BENEID CLMBEGINDATE MAINJTCODE);                      
000163    SET JTREP2;                                                          
000164    BY BENEID CLMBEGINDATE DESCENDING AMTPAIDPROV;                       
000165                                                                         
000166    IF FIRST.BENEID OR FIRST.CLMBEGINDATE;                               
000167     MAINJTCODE = CPTCODE;                                               
000168     ** MOST EXPENSIVE JT REPL CODE FOR THAT PATIENT ON THAT DATE **;    
000169   RUN;                                                                  
000170                                                                         
000171   ************************************************************;         
000172   * FIND ADMIT AND DISCHARGE DATE              **;                      
000173   ************************************************************;         
000174                                                                         
000175  DATA ADMIT1 (KEEP=BENEID ADMITDATE DCDATE CLMENDDATE);                 
000176    SET EPCLAIM1.DATA;                                                   
000177    WHERE (HOSPPROF="1");                                                
000178    IF DCDATE > TODAY() THEN DCDATE = CLMENDDATE;                        
000179  RUN;                                                                   
000180                                                                         
000181  PROC SORT DATA=ADMIT1 OUT=ADMIT2 NODUPKEY;                             
 000182     BY BENEID ADMITDATE DCDATE CLMENDDATE;                             
 000183     RUN;                                                               
 000184                                                                        
 000185  PROC SQL;                                                             
 000186     CREATE TABLE SELECT1.DATA AS                                       
 000187       SELECT A.BENEID,                                                 
 000188              A.MAINJTCODE,                                             
 000189              MIN(CASE                                                  
 000190              WHEN B.ADMITDATE IS NULL THEN A.CLMBEGINDATE              
 000191              ELSE B.ADMITDATE                                          
 000192     END) AS EPBEGINDATE,                                               
 000193            MAX(CASE                                                    
 000194            WHEN B.DCDATE IS NULL THEN A.CLMBEGINDATE ELSE B.DCDATE     
 000195            END) AS EPENDDATE FROM JTREP AS A LEFT JOIN ADMIT2 AS B ON  
 000196            (A.BENEID = B.BENEID AND B.ADMITDATE <= A.CLMBEGINDATE      
 000197            AND B.CLMENDDATE < B.DCDATE)                                
 000198            GROUP BY A.BENEID, A.MAINJTCODE, A.CLMBEGINDATE;            
 000199         QUIT;                                                          
 000200                                                                        
 000201  PROC PRINT DATA=SELECT1.DATA (OBS=100); TITLE 'SELECT1.DATA'; RUN;    
 000202                                                                        
 000203  **********************************************************;           
 000204 ** DIAGNOSIS CODES/DESCRIPTIONS                           **;          
 000205 ************************************************************;          
 000206                                                                        
 000207 PROC SQL;                                                              
 000208    CONNECT TO DB2(SSID=DBR0);                                           
 000209    EXECUTE(SET CURRENT DEGREE='ANY') BY DB2;                            
 000210    CREATE TABLE ICD10 AS                                                
 000211      SELECT* FROM CONNECTION TO DB2                                     
 000212      (SELECT                                                            
 000213         PIWD.ICD_DGNS.DGNS_CD     AS DIAGCODE,                          
 000214         PIWD.ICD_DGNS.DGNS_SHRT_DESC  AS DIAGDESC,                      
 000215         PIWD.ICD_DGNS.ICD_VRSN_IND    AS ICDVERSIONIND                  
 000216       FROM                                                              
 000217         PIWD.ICD_DGNS                                                   
 000218      );                                                                 
 000219      %PUT &SQLXMSG &SQLXRC;                                             
 000220                                                                         
 000221 **************************************************;                     
 000222 **    CPT CODES/DESCRIPTIONS                    **;                     
 000223 **************************************************;                     
 000224                                                                         
 000225 PROC SQL;                                                               
 000226   CONNECT TO DB2(SSID=DBR0);                                            
 000227   EXECUTE(SET CURRENT DEGREE='ANY') BY DB2;                             
 000228   CREATE TABLE CPT AS                                                   
 000229     SELECT* FROM CONNECTION TO DB2                                      
 000230     (SELECT                                                             
 000231        PIWD.CPT_CD_LOV.CPT_CD         AS CPTCODE,                       
 000232        PIWD.CPT_CD_LOV.CPT_CD_DESC     AS CPTDESC                       
 000233      FROM                                                               
000234          PIWD.CPT_CD_LOV                                                
000235     );                                                                  
000236     %PUT &SQLXMSG &SQLXRC;                                              
000237                                                                         
000238  **********************************************************;            
000239 ** ALL EPISODE OF CARE CLAIMS**                                         
000240 ************************************************************;           
000241                                                                         
000242                                                                         
000243     PROC SQL;                                                           
000244        CREATE TABLE CLAIM1.DATA AS                                      
000245        SELECT DISTINCT                                                  
000246          A.*,                                                           
000247          B.EPBEGINDATE,                                                 
000248          B.EPENDDATE,                                                   
000249          B.MAINJTCODE                                                   
000250        FROM EPCLAIM1.DATA AS A, SELECT1.DATA AS B                       
000251        WHERE (A.BENEID = B.BENEID)                                      
000252             AND (                                                       
000253              (/* OCCURRED DURING SURGERY STAY */                        
000254                A.CLMBEGINDATE >= B.EPBEGINDATE                          
000255                    AND A.CLMENDDATE <= B.EPENDDATE)                     
000256                OR (/* ORTHOPEDIC SPECIALIST */                          
000257                  A.SPECCODE IN &SPECLIST)                               
000258                OR (/* PHYSICAL THERAPY */                               
000259                   (A.SPECCODE = '65'                                    
000260                      OR A.CPTCODE IN ('97001','97002','97750','97751', 
000261                                       '97752','97753','97754','97755', 
000262                                       '97799')                         
000263                         OR (A.CPTCODE BETWEEN '97010' AND '97546')     
000264                          )/** CLOSES OFF LOGIC TO IDENTIFY PT **/      
000265             AND A.SPECCODE <> 'A3') /** NOT OCCUPATIONAL THERAPY **/   
000266                   /** CLOSES OFF COMPLETE PT LOGIC **/                 
000267             OR (/** MUSCULOSKELETAL DIAGNOSIS CODE **/                 
000268               (SUBSTR(A.DIAGCODE,1,1)="M")  )                          
000269           OR ( /* AFTERCARE CODE AFTER ORTHO SURG */                   
000270             A.CLMBEGINDATE > B.EPBEGINDATE                             
000271          AND (SUBSTR(A.DIAGCODE,1,6) IN ('Z471','Z472','Z473','Z4731', 
000272                                      'Z4732','Z4733')) OR              
000273             (SUBSTR(A.DIAGCODE,1,6) BETWEEN 'Z966' AND 'Z96669')       
000274           )                                                            
000275           );                                                           
000276       QUIT;                                                            
000277                                                                        
000278                                                                        
000279   **MAKE SURE NO ISSUES WITH TRANSFERS**                               
000280                                                                        
000281    PROC SORT DATA = CLAIM1.DATA OUT=CLAIM2 NODUPKEY;                   
000282       BY CLAIMBASEID CLAIMLINEID;                                      
000283       RUN;                                                             
000284                                                                        
000285    PROC PRINT DATA = CLAIM2;                                           
000286         TITLE 'CLAIM2';                                               
000287    RUN;                                                               
000288                                                                       
000289   ************************************************************;       
000290   * DEFINE OTHER VARIABLES NEEDED FOR REPORT                **;       
000291   ************************************************************;       
000292   %INCLUDE 'A080356.MACRO1.SAS(CLAIMS)'; * CLAIMS MACRO *;            
000293   DATA CLAIM2;                                                        
000294     SET CLAIM1;                                                       
000295   &YEARMONTH;                                                         
000296   &AGECAT; **AGE RANGE**                                              
000297   FORMAT NETWORKCLMS NET.;                                            
000298   FORMAT PLACEOFSERVICE POS.;                                         
000299   FORMAT HOSPPROF HP.;                                                
000300   &DIAGCHAP;                                                          
000301   &DIAGFORM;                                                          
000302   IF TRIM(CPTCODE) IN ('27438','27446','27447','27486','27487',       
000303   '27488','27445','27090','27091','27125','27130','27132',            
000304   '27134','27236','27137','27138','23472','23470','23473',            
000305   '23474','24363','24370','24371','25446','27702','27703',            
000306   '27704') THEN TYPE = "JOINT REPLACEMENT PROCEDURE";                 
000307     ELSE IF DRGNUMBER IN                                              
000308         ('483','507','508','515','516','517','484','469','470')       
000309      OR DRGNUMBER BETWEEN ('466' AND '470') THEN TYPE =               
000310      "JOINT REPLACEMENT PROCEDURE";                                   
000311   ELSE IF EPBEGINDATE <= CLMBEGINDATE AND CLMBEGINDATE <= EPENDDATE   
000312    THEN TYPE = "DURING HOSPITALIZATION";                                
000313   ELSE                                                                  
000314    IF CLMBEGINDATE < EPBEGINDATE THEN TYPE = "PRE-OPERATIVE CARE";      
000315    ELSE IF CLMBEGINDATE > EPENDDATE THEN DO;                            
000316    IF (TRIM(CPTCODE) IN ('97001','97002','97750','97751',               
000317                      '97752','97753','97754','97755',                   
000318                      '97799') OR TRIM(CPTCODE)                          
000319                      BETWEEN '97010' AND '97546' OR                     
000320                      SPECCODE = '65') AND SPECCODE <>"A3"               
000321    THEN TYPE = "POST-OPERATIVE PHYSICAL THERAPY";                       
000322     ELSE TYPE = "OTHER POST-OPERATIVE CARE";                            
000323     END;                                                                
000324    ELSE TYPE = "OTHER";                                                 
000325                                                                         
000326   IF PTSEXRELCODE IN('2','4','6','8',"B",OR"C") THEN GENDER = "FEMALE"; 
000327       ELSE GENDER = "MALE";                                             
000328   RUN;                                                                  
000329                                                                         
000330  PROC SQL;                                                              
000331     CREATE TABLE DETAIL AS                                              
000332       SELECT                                                            
000333         A.BENEID,                                                       
000334         A.EPBEGINDATE,                                                  
000335         A.EPENDDATE,                                                    
000336         A.MAINJTCODE,                                                   
000337         A.YEARMONTH,                                                    
000338         A.ENROLLPRIMECAT,                                              
000339         A.CATEGORY,                                                    
000340         A.AGERANGE,                                                    
000341         A.GENDER,                                                      
000342         A.TYPE,                                                        
000343         A.SPECDESC,                                                    
000344         A.PLACEOFSERVICE,                                              
000345         A.HOSPPROF,                                                    
000346         A.PROVAFFNAMECLMS,                                             
000347         A.NETWORKCLMS,                                                 
000348         A.DIAGCHAP,                                                    
000349         A.DIAGFORM,                                                    
000350         B.DIAGDESC,                                                    
000351         A.CPTCODE,                                                     
000352         C.CPTDESC,                                                     
000353         A.DRGNUMBER,                                                   
000354         A.CLAIMBASEID,                                                 
000355         A.VISITKEY,                                                    
000356         A.ADMITKEY,                                                    
000357         SUM(A.AMTTOTALBILLED) AS AMTTOTALBILLED,                       
000358         SUM(A.AMTPAIDPROV) AS AMTPAIDPROV,                             
000359         SUM(A.AMTALLOWED) AS AMTALLOWED,                               
000360         SUM(A.NBRSVCS) AS NBRSVCS                                      
000361       FROM CLAIM3 AS A LEFT JOIN ICD10 AS B                            
000362       ON (TRIM(A.DIAGFORM)=TRIM(B.DIAGCODE)                            
000363       AND A.ICDVERSIONIND = B.ICDVERSIONIND)                           
000364       LEFT JOIN CPT AS C ON A.CPTCODE = C.CPTCODE                       
000365       GROUP BY                                                          
000366         A.BENEID,                                                       
000367         A.EPBEGINDATE,                                                  
000368         A.EPENDDATE,                                                    
000369         A.MAINJTCODE,                                                   
000370         A.YEARMONTH,                                                    
000371         A.ENROLLPRIMECAT,                                               
000372         A.CATEGORY,                                                     
000373         A.AGERANGE,                                                     
000374         A.GENDER,                                                       
000375         A.TYPE,                                                         
000376         A.SPECDESC,                                                     
000377         A.PLACEOFSERVICE,                                               
000378         A.HOSPPROF,                                                     
000379         A.PROVAFFNAMECLMS,                                              
000380         A.NETWORKCLMS,                                                  
000381         A.DIAGCHAP,                                                     
000382         A.DIAGFORM,                                                     
000383         B.DIAGDESC,                                                     
000384         A.CPTCODE,                                                      
000385         C.CPTDESC,                                                      
000386         A.DRGNUMBER,                                                    
000387         A.CLAIMBASEID,                                                  
000388         A.VISITKEY,                                                     
000389         A.ADMITKEY;                                                     
000390     QUIT;                                                               
000391  PROC PRINT DATA=DETAIL (OBS=100); TITLE 'DETAIL'; RUN;                 
000392                                                                         
000393                                                                         
000394                                                                         
000395                                                                         
000396                                                                         
000397                                                                         
000398                                                                         
000399                                                                         
000400   ************************************************************;         
000401   * SUMMARY REPORT                                          **;         
000402   ************************************************************;         
000403   PROC SUMMARY NWAY MISSING DATA=DETAIL;                                
000404      CLASS BENEID                                                       
000405        TYPE;                                                            
000406     VAR AMTPAIDPROV;                                                    
000407     OUTPUT OUT=CLAIMB SUM=;                                             
000408                                                                         
000409     DATA CLAIMC;                                                        
000410     SET CLAIMB;                                                         
000411     IF TRIM(TYPE) = "PRE-OPERATIVE CARE" THEN PAID1 = AMTPAIDPROV;      
000412 ELSE IF TRIM(TYPE) = "JOINT REPLACEMENT PROCEDURE"                      
000413      THEN PAID2 = AMTPAIDPROV;                                          
000414     ELSE IF TRIM(TYPE) = "DURING HOSPITALIZATION" THEN                  
000415     PAID3 = AMTPAIDPROV;                                                
 000416     ELSE IF TRIM(TYPE) = "POST-OPERATIVE PHYSICAL THERAPY" THEN         
 000417     PAID4 = AMTPAIDPROV; ELSE IF(TYPE) = "OTHER POST-OPERATIVE CARE"    
 000418      THEN PAID5 = AMTPAIDPROV; ELSE PAID6 = AMTPAIDPROV; RUN;           
 000419                                                                         
 000420  PROC SUMMARY NWAY MISSING DATA=CLAIMC;                                 
 000421    CLASS BENEID;                                                        
 000422    VAR PAID1 PAID2 PAID3 PAID4 PAID5 PAID6;                             
 000423  OUTPUT OUT=SUMMARY SUM=;                                               
 000424  %TILOUT1(DETAIL,OUT1);                                                 
 000425  %TILOUT1(SUMMARY,OUT2);                                                
 000426                                                                         
 000427 ENDSAS;                                                                 
 000428                                                                         
 000429                                                                         
Super User
Posts: 6,963

Re: Stuck on this one!

The error is here:

000279   **MAKE SURE NO ISSUES WITH TRANSFERS**                               
000280                                                                        
000281    PROC SORT DATA = CLAIM1.DATA OUT=CLAIM2 NODUPKEY;   

The ** opens a comment, which ends at the semicolon supposed to end the proc sort statement.

Add a semicolon here:

000279   **MAKE SURE NO ISSUES WITH TRANSFERS**;

to end the comment where it should end.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 37

Re: Stuck on this one!

Thank you! I can't believe I overlooked that.  Fingers crossed

PROC Star
Posts: 7,364

Re: Stuck on this one!

I presume this is part of the macro you were enquiring about over the past few days. If so, do not use the star style comment. Change it to /*   whatever */

 

SAS macros don't honor the plain * style comments (even with ending semi-colons)

 

Art, CEO, AnalystFinder.com

 

Super User
Posts: 6,963

Re: Stuck on this one!


essdee wrote:

Thank you! I can't believe I overlooked that.  Fingers crossed


Sometimes another pair of eyes is needed. Things happen.

Been there, done that.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 37

Re: Stuck on this one! (Error again)

4733         IF PTSEXRELCODE IN('2','4','6','8',"B",OR"C") THEN GENDER = "FEMALE
                                                    __                          
                                                    __                          
                                                    __                          
                                                    22                          
                                                    22                          
                                                    22                          
                                                      ___                       
                                                      ___                       
                                                      ___                       
                                                      200                       
                                                      200                       
                                                      200                       
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a n
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a n
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a n
              a missing value, iterator, (.                                     
              a missing value, iterator, (.                                     
              a missing value, iterator, (.                                     
                                                                                
ERROR 200-322: The symbol is not recognized and will be ignored.                
ERROR 200-322: The symbol is not recognized and will be ignored.                
ERROR 200-322: The symbol is not recognized and will be ignored.                
11                                                         The SAS System       
                                                                                
                                                                                
4734             ELSE GENDER = "MALE";                                          
4735         RUN;                                                               
                                                                                                    
Super User
Super User
Posts: 6,502

Re: Stuck on this one! (Error again)

Why do you have the letters OR there?  If you want to match those characters then they need to be quoted like the other values in the list.

Contributor
Posts: 37

Re: Stuck on this one!

[ Edited ]
000059 OPTIONS OBS=MAX LS=132 SORT=2000 SORTPGM=BEST NOSORTDEVWARN;           
000060                                                                        
000061   %INCLUDE 'FPCENRI.MACRO1.SAS(TILOUT1)'; * OUTPUT MACRO *;            
000062                                                                        
000063   ************************************************************;        
000064   * DEFINE SPECIFICATIONS                                   **;        
000065   ************************************************************;        
000066                                                                        
000067   %LET BEGDT = 01JAN2016 ; ** BEG. DOS                            ;    
000068   %LET ENDDT = 31DEC2016  ; ** END. DOS                           ;    
000069   %LET SPECLIST = ('20','T7');                                         
000070                                                                        
000071   PROC FORMAT;                                                         
000072      VALUE $PRIME 'PRIMECIV' = 'PRIME CIVILIAN'                        
000073                   'PRIMEMTF' = 'PRIME MTF';                            
000074      VALUE $NET   'I'        = 'NETWORK'                               
000075                   'O'        = 'NONNETWORK';                           
000076      VALUE $HP  '1'='HOSPITAL INPATIENT'                               
000077                 '2'='HOSPITAL OUTPATIENT MATERNITY'                    
000078                 '3'='HOSPITAL OUTPATIENT'                             
000079                 '4'='PROFESSIONAL INPATIENT'                          
000080                 '5'='PROFESSIONAL OUTPATIENT MATERNITY'               
000081                 '6'='PROFESSIONAL OUTPATIENT'                         
000082                 '7'='AMBULATORY SURGERY FACILITY';                    
000083                                                                       
000084      VALUE $POS '0'='OTHER NOT CLASSIFIED'                            
000085                  '1'='INPATIENT HOSPITAL'                             
000086                  '2'='OUTPATIENT HOSPITAL'                            
000087                  '3'='PHYSICIANS OFFICE'                              
000088                  '4'='PATIENTS HOME'                                  
000089                  '5'='DAYCARE PSYCHIATRIC'                            
000090                  '6'='NIGHTCARE PSYCHIATRIC'                          
000091                  '7'='NURSING HOME DOMICILIARY'                       
000092                  '8'='SNF EXTENDED CARE'                              
000093                  '9'='AMBULANCE HOSPITAL'                             
000094                  'A'='INDEPENDENT LAB'                                
000095                  'B'='OTHER MEDICAL SURGICAL FACILITY'                
000096                  'C'='DENTAL'                                         
000097                  'D'='RESIDENTAL TREATMENT FACILITY'                  
000098                  'E'='OUTPATIENT TREATMENT FACILITY';                 
000099   RUN;                                                                
000100                                                                       
000101  ************************************************************;        
000102  * EXTRACT ALL POTENTIAL EPISODE OF CARE CLAIMS            **;        
000103  ************************************************************;        
000104                                                                         
000105  DATA EPCLAIM1.DATA (KEEP=BENEID SPONSORPPI PATIENTID CLAIMBASEID       
000106                           CLAIMLINEID ADMITDATE CLMBEGINDATE            
000107                           CLMENDDATE DCDATE PROVAFFCLMS PROVAFFNAMECLMS 
000108                           SPECDESC ZIP5CLMS HOSPPROF CPTCODE            
000109                           AMTALLOWED AMTTOTALBILLED AMTPAIDPROV         
000110                           PROVTYPECLMS PROVSPEC BENECATEGORY            
000111                           NBRSVCS DIAGCODE MTFNUMBER ICDVERSIONIND      
000112                           REVCODE PLACEOFSERVICE NETWORKCLMS            
000113                           ENROLLSTATUS DRGNUMBER PATIENTDOB             
000114                           ENROLLPRIMECAT SPECCODE PTSEXRELCODE          
000115                   );                                                    
000116     SET CLMDATA.DATA;                                                   
000117     WHERE (                                                             
000118            CLMBEGINDATE >= "&BEGDT"D                                    
000119            AND                                                          
000120            "&ENDDT"D >= CLMBEGINDATE                                    
000121           AND MTFNUMBER = '0056');                                      
000122  RUN;                                                                   
000123                                                                         
000124  PROC PRINT DATA=EPCLAIM1.DATA (OBS=100); RUN;                          
000125                                                                         
000126                                                                         
000127   ************************************************************;         
000128   * EXTRACT JOINT REPLACEMENT CLAIMS                         *;         
000129   * KNEE/HIP/SHOULDER/WRIST/ELBOW/ANKLE                       ;         
000130   ************************************************************;      
000131                                                                      
000132  DATA JTREP (KEEP = BENEID CLMBEGINDATE CLMENDDATE CPTCODE           
000133     AMTPAIDPROV );                                                   
000134     SET EPCLAIM1.DATA;                                               
000135  WHERE ("&BEGDT"D  LE CLMBEGINDATE                                   
000136          AND                                                         
000137          CLMBEGINDATE LE "&ENDDT"D                                   
000138          AND                                                         
000139         (TRIM(CPTCODE) IN ('27438','27446','27447','27486','27487',  
000140          '27488','27445','27090','27091','27125','27130','27132',    
000141          '27134','27236','27137','27138','23472','23470','23473',    
000142          '23474','24363','24370','24371','25446','27702','27703',    
000143          '27704') OR DRGNUMBER IN ('466','467','468','469','470',    
000144          '483','507','508','515','516','517','484')                  
000145          ));                                                         
000146                                                                      
000147  RUN;                                                                
000148                                                                      
000149  PROC PRINT DATA=JTREP (OBS=100); TITLE 'JTREP'; RUN;                
000150                                                                      
000151  PROC SUMMARY NWAY MISSING DATA=JTREP;                               
000152   CLASS BENEID CLMBEGINDATE CPTCODE;                                 
000153   VAR   AMTPAIDPROV;                                                 
000154   OUTPUT OUT=JTREP1 SUM=;                                            
000155  PROC PRINT DATA=JTREP1 (OBS=100); TITLE 'JTREP1'; RUN;              
000156                                                                        
000157  ** HIGHEST COST PROCEDURE PER EPISODE FIRST **;                       
000158  PROC SORT DATA=JTREP1 OUT=JTREP2;                                     
000159    BY BENEID CLMBEGINDATE DESCENDING AMTPAIDPROV;                      
000160  RUN;                                                                  
000161                                                                        
000162  DATA JTREP (KEEP=BENEID CLMBEGINDATE MAINJTCODE);                     
000163    SET JTREP2;                                                         
000164    BY BENEID CLMBEGINDATE DESCENDING AMTPAIDPROV;                      
000165                                                                        
000166    IF FIRST.BENEID OR FIRST.CLMBEGINDATE;                              
000167     MAINJTCODE = CPTCODE;                                              
000168     ** MOST EXPENSIVE JT REPL CODE FOR THAT PATIENT ON THAT DATE **;   
000169   RUN;                                                                 
000170                                                                        
000171   ************************************************************;        
000172   * FIND ADMIT AND DISCHARGE DATE              **;                     
000173   ************************************************************;        
000174                                                                        
000175  DATA ADMIT1 (KEEP=BENEID ADMITDATE DCDATE CLMENDDATE);                
000176    SET EPCLAIM1.DATA;                                                  
000177    WHERE (HOSPPROF="1");                                               
000178    IF DCDATE > TODAY() THEN DCDATE = CLMENDDATE;                       
000179  RUN;                                                                  
000180                                                                        
000181  PROC SORT DATA=ADMIT1 OUT=ADMIT2 NODUPKEY;                            
000182     BY BENEID ADMITDATE DCDATE CLMENDDATE;                              
000183     RUN;                                                                
000184                                                                         
000185  PROC SQL;                                                              
000186     CREATE TABLE SELECT1.DATA AS                                        
000187       SELECT A.BENEID,                                                  
000188              A.MAINJTCODE,                                              
000189              MIN(CASE                                                   
000190              WHEN B.ADMITDATE IS NULL THEN A.CLMBEGINDATE               
000191              ELSE B.ADMITDATE                                           
000192     END) AS EPBEGINDATE,                                                
000193            MAX(CASE                                                     
000194            WHEN B.DCDATE IS NULL THEN A.CLMBEGINDATE ELSE B.DCDATE      
000195            END) AS EPENDDATE FROM JTREP AS A LEFT JOIN ADMIT2 AS B ON   
000196            (A.BENEID = B.BENEID AND B.ADMITDATE <= A.CLMBEGINDATE       
000197            AND B.CLMENDDATE < B.DCDATE)                                 
000198            GROUP BY A.BENEID, A.MAINJTCODE, A.CLMBEGINDATE;             
000199         QUIT;                                                           
000200                                                                         
000201  PROC PRINT DATA=SELECT1.DATA (OBS=100); TITLE 'SELECT1.DATA'; RUN;     
000202                                                                         
000203  **********************************************************;            
000204 ** DIAGNOSIS CODES/DESCRIPTIONS                           **;           
000205 ************************************************************;           
000206                                                                         
000207 PROC SQL;                                                               
000208    CONNECT TO DB2(SSID=DBR0);                                    
000209    EXECUTE(SET CURRENT DEGREE='ANY') BY DB2;                     
000210    CREATE TABLE ICD10 AS                                         
000211      SELECT* FROM CONNECTION TO DB2                              
000212      (SELECT                                                     
000213         PIWD.ICD_DGNS.DGNS_CD     AS DIAGCODE,                   
000214         PIWD.ICD_DGNS.DGNS_SHRT_DESC  AS DIAGDESC,               
000215         PIWD.ICD_DGNS.ICD_VRSN_IND    AS ICDVERSIONIND           
000216       FROM                                                       
000217         PIWD.ICD_DGNS                                            
000218      );                                                          
000219      %PUT &SQLXMSG &SQLXRC;                                      
000220                                                                  
000221 **************************************************;              
000222 **    CPT CODES/DESCRIPTIONS                    **;              
000223 **************************************************;              
000224                                                                  
000225 PROC SQL;                                                        
000226   CONNECT TO DB2(SSID=DBR0);                                     
000227   EXECUTE(SET CURRENT DEGREE='ANY') BY DB2;                      
000228   CREATE TABLE CPT AS                                            
000229     SELECT* FROM CONNECTION TO DB2                               
000230     (SELECT                                                      
000231        PIWD.CPT_CD_LOV.CPT_CD         AS CPTCODE,                
000232        PIWD.CPT_CD_LOV.CPT_CD_DESC     AS CPTDESC                
000233      FROM                                                        
000234          PIWD.CPT_CD_LOV                                          
000235     );                                                            
000236     %PUT &SQLXMSG &SQLXRC;                                        
000237                                                                   
000238  **********************************************************;      
000239 ** ALL EPISODE OF CARE CLAIMS**                                   
000240 ************************************************************;     
000241                                                                   
000242                                                                   
000243     PROC SQL;                                                     
000244        CREATE TABLE CLAIM1.DATA AS                                
000245        SELECT DISTINCT                                            
000246          A.*,                                                     
000247          B.EPBEGINDATE,                                           
000248          B.EPENDDATE,                                             
000249          B.MAINJTCODE                                             
000250        FROM EPCLAIM1.DATA AS A, SELECT1.DATA AS B                 
000251        WHERE (A.BENEID = B.BENEID)                                
000252             AND (                                                 
000253              (/* OCCURRED DURING SURGERY STAY */                  
000254                A.CLMBEGINDATE >= B.EPBEGINDATE                    
000255                    AND A.CLMENDDATE <= B.EPENDDATE)               
000256                OR (/* ORTHOPEDIC SPECIALIST */                    
000257                  A.SPECCODE IN &SPECLIST)                         
000258                OR (/* PHYSICAL THERAPY */                         
000259                   (A.SPECCODE = '65'                              
 000260                      OR A.CPTCODE IN ('97001','97002','97750','97751',  
 000261                                       '97752','97753','97754','97755',  
 000262                                       '97799')                          
 000263                         OR (A.CPTCODE BETWEEN '97010' AND '97546')      
 000264                          )/** CLOSES OFF LOGIC TO IDENTIFY PT **/       
 000265             AND A.SPECCODE <> 'A3') /** NOT OCCUPATIONAL THERAPY **/    
 000266                   /** CLOSES OFF COMPLETE PT LOGIC **/                  
 000267             OR (/** MUSCULOSKELETAL DIAGNOSIS CODE **/                  
 000268               (SUBSTR(A.DIAGCODE,1,1)="M")  )                           
 000269           OR ( /* AFTERCARE CODE AFTER ORTHO SURG */                    
 000270             A.CLMBEGINDATE > B.EPBEGINDATE                              
 000271          AND (SUBSTR(A.DIAGCODE,1,6) IN ('Z471','Z472','Z473','Z4731',  
 000272                                      'Z4732','Z4733')) OR               
 000273             (SUBSTR(A.DIAGCODE,1,6) BETWEEN 'Z966' AND 'Z96669')        
 000274           )                                                             
 000275           );                                                            
 000276       QUIT;                                                             
 000277                                                                         
 000278                                                                         
 000279   **MAKE SURE NO ISSUES WITH TRANSFERS**;                               
 000280                                                                         
 000281    PROC SORT DATA = CLAIM1.DATA OUT=CLAIM2 NODUPKEY;                    
 000282       BY CLAIMBASEID CLAIMLINEID;                                       
 000283       RUN;                                                              
 000284                                                                         
 000285    PROC PRINT DATA = CLAIM2;                                            
000286         TITLE 'CLAIM2';                                              
000287    RUN;                                                              
000288                                                                      
000289   ************************************************************;      
000290   * DEFINE OTHER VARIABLES NEEDED FOR REPORT                **;      
000291   ************************************************************;      
000292   %INCLUDE 'A080356.MACRO1.SAS(CLAIMS)'; * CLAIMS MACRO *;           
000293   DATA CLAIM2;                                                       
000294     SET CLAIM1.DATA;                                                 
000295   &YEARMONTH;                                                        
000296   &AGECAT;                                                           
000297   FORMAT NETWORKCLMS NET.;                                           
000298   FORMAT PLACEOFSERVICE POS.;                                        
000299   FORMAT HOSPPROF HP.;                                               
000300   &DIAGCHAP;                                                         
000301   &DIAGFORM;                                                         
000302   IF TRIM(CPTCODE) IN ('27438','27446','27447','27486','27487',      
000303   '27488','27445','27090','27091','27125','27130','27132',           
000304   '27134','27236','27137','27138','23472','23470','23473',           
000305   '23474','24363','24370','24371','25446','27702','27703',           
000306   '27704') THEN TYPE = "JOINT REPLACEMENT PROCEDURE";                
000307     ELSE IF DRGNUMBER IN                                             
000308         ('483','507','508','515','516','517','484','469','470')      
000309      OR DRGNUMBER IN ('466','467','468','469','470') THEN            
000310     TYPE = "JOINT REPLACEMENT PROCEDURE";                            
000311   ELSE IF EPBEGINDATE <= CLMBEGINDATE AND CLMBEGINDATE <= EPENDDATE  
000312    THEN TYPE = "DURING HOSPITALIZATION";                              
000313   ELSE                                                                
000314    IF CLMBEGINDATE < EPBEGINDATE THEN TYPE = "PRE-OPERATIVE CARE";    
000315    ELSE IF CLMBEGINDATE > EPENDDATE THEN DO;                          
000316    IF (TRIM(CPTCODE) IN ('97001','97002','97750','97751',             
000317                      '97752','97753','97754','97755',                 
000318                      '97799') OR                                      
000319                    ('97010'<= TRIM(CPTCODE)<='97546') AND             
000320                      SPECCODE = '65') AND SPECCODE <>"A3"             
000321    THEN TYPE = "POST-OPERATIVE PHYSICAL THERAPY";                     
000322     ELSE TYPE = "OTHER POST-OPERATIVE CARE";                          
000323     END;                                                              
000324    ELSE TYPE = "OTHER";                                               
000325                                                                       
000326  IF PTSEXRELCODE IN('2','4','6','8','B','C')                          
000327       THEN GENDER = "FEMALE";                                         
000328       ELSE GENDER = "MALE";                                           
000329   RUN;                                                                
000330                                                                       
000331  PROC SQL;                                                            
000332     CREATE TABLE DETAIL AS                                            
000333       SELECT                                                          
000334         A.BENEID,                                                     
000335         A.EPBEGINDATE,                                                
000336         A.EPENDDATE,                                                  
000337         A.CLMBEGINDATE,                                               
000338         A.ADMITDATE,                                                
000339         A.MAINJTCODE,                                               
000340         A.YEARMONTH,                                                
000341         A.ENROLLPRIMECAT,                                           
000342         A.AGERANGE,                                                 
000343         A.GENDER,                                                   
000344         A.TYPE,                                                     
000345         A.SPECDESC,                                                 
000346         A.PLACEOFSERVICE,                                           
000347         A.HOSPPROF,                                                 
000348         A.PROVAFFNAMECLMS,                                          
000349         A.NETWORKCLMS,                                              
000350         A.DIAGCHAP,                                                 
000351         A.DIAGFORM,                                                 
000352         B.DIAGDESC,                                                 
000353         A.CPTCODE,                                                  
000354         C.CPTDESC,                                                  
000355         A.DRGNUMBER,                                                
000356         A.CLAIMBASEID,                                              
000357         SUM(A.AMTTOTALBILLED) AS AMTTOTALBILLED,                    
000358         SUM(A.AMTPAIDPROV) AS AMTPAIDPROV,                          
000359         SUM(A.AMTALLOWED) AS AMTALLOWED,                            
000360         SUM(A.NBRSVCS) AS NBRSVCS                                   
000361       FROM CLAIM2 AS A LEFT JOIN ICD10 AS B                         
000362       ON (TRIM(A.DIAGFORM)=TRIM(B.DIAGCODE)                         
000363       AND A.ICDVERSIONIND = B.ICDVERSIONIND)                        
000364       LEFT JOIN CPT AS C ON A.CPTCODE = C.CPTCODE                      
000365       GROUP BY                                                         
000366         A.BENEID,                                                      
000367         A.EPBEGINDATE,                                                 
000368         A.EPENDDATE,                                                   
000369         A.CLMBEGINDATE,                                                
000370         A.ADMITDATE,                                                   
000371         A.MAINJTCODE,                                                  
000372         A.YEARMONTH,                                                   
000373         A.ENROLLPRIMECAT,                                              
000374         A.AGERANGE,                                                    
000375         A.GENDER,                                                      
000376         A.TYPE,                                                        
000377         A.SPECDESC,                                                    
000378         A.PLACEOFSERVICE,                                              
000379         A.HOSPPROF,                                                    
000380         A.PROVAFFNAMECLMS,                                             
000381         A.NETWORKCLMS,                                                 
000382         A.DIAGCHAP,                                                    
000383         A.DIAGFORM,                                                    
000384         B.DIAGDESC,                                                    
000385         A.CPTCODE,                                                     
000386         C.CPTDESC,                                                     
000387         A.DRGNUMBER,                                                   
000388         A.CLAIMBASEID;                                                 
000389     QUIT;                                                              
 000390  PROC PRINT DATA=DETAIL (OBS=100); TITLE 'DETAIL'; RUN;                 
 000391                                                                         
 000392                                                                         
 000393                                                                         
 000394                                                                         
 000395                                                                         
 000396                                                                         
 000397                                                                         
 000398                                                                         
 000399   ************************************************************;         
 000400   * SUMMARY REPORT                                          **;         
 000401   ************************************************************;         
 000402   PROC SUMMARY NWAY MISSING DATA=DETAIL;                                
 000403      CLASS BENEID                                                       
 000404        TYPE;                                                            
 000405     VAR AMTPAIDPROV;                                                    
 000406     OUTPUT OUT=CLAIMB SUM=;                                             
 000407                                                                         
 000408     DATA CLAIMC;                                                        
 000409     SET CLAIMB;                                                         
 000410     IF TRIM(TYPE) = "PRE-OPERATIVE CARE" THEN PAID1 = AMTPAIDPROV;      
 000411 ELSE IF TRIM(TYPE) = "JOINT REPLACEMENT PROCEDURE"                      
 000412      THEN PAID2 = AMTPAIDPROV;                                          
 000413     ELSE IF TRIM(TYPE) = "DURING HOSPITALIZATION" THEN                  
 000414     PAID3 = AMTPAIDPROV;                                                
 000415     ELSE IF TRIM(TYPE) = "POST-OPERATIVE PHYSICAL THERAPY" THEN         
000416     PAID4 = AMTPAIDPROV; ELSE IF(TYPE) = "OTHER POST-OPERATIVE CARE"  
000417      THEN PAID5 = AMTPAIDPROV; ELSE PAID6 = AMTPAIDPROV; RUN;         
000418                                                                       
000419  PROC SUMMARY NWAY MISSING DATA=CLAIMC;                               
000420    CLASS BENEID;                                                      
000421    VAR PAID1 PAID2 PAID3 PAID4 PAID5 PAID6;                           
000422  OUTPUT OUT=SUMMARY SUM=;                                             
000423  %TILOUT1(DETAIL,OUT1);                                               
000424  %TILOUT1(SUMMARY,OUT2);                                              
000425                                                                       
000426 ENDSAS;                                                               
000427                                                                       

My program ran but when exported to Excel, the EPBEGINDATE and EPENDDATE look like this -> 20709, etc.

 

 

How do I format these to make them look like mmddyyyy -> ex. 03/21/2017? And where in the program would I do this?

 

 

Super User
Posts: 6,963

Re: Stuck on this one!

Excel recognizes date values according to it's locale setting. A really beautiful feature, that is.

Make sure you use a proper date format during the export.

If in doubt, post the data step code that writes the file used for transfer to Excel.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 37

Re: Stuck on this one!

Even during the export it has that same format. strange
Super User
Posts: 6,963

Re: Stuck on this one!

When dates appear as raw (5-digit) numbers in proc print or similar, the variables lacked the proper display format.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 37

Re: Stuck on this one!

I remembered the format - I used DATE9. for those two variables.
Ask a Question
Discussion stats
  • 13 replies
  • 249 views
  • 2 likes
  • 4 in conversation