<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Result generated are different from expectation. in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398722#M3513</link>
    <description>&lt;P&gt;There's errors in your log. Fix the steps with the errors first - you truncated the log so I can't say where.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT - the full log is there, didn't show in preview for some reason. Please do not use attachement but post things directly into the forum.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's easier to work with. The answers the same still though, your SQL query has a syntax error, I think you need the word AS for the alias.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fix that, and you'll likely at least be one step further. &amp;nbsp;If there's an error in your log it helps if you state that at the start and include it, rather than us having to ask for it. And always read the log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Sep 2017 04:49:31 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-09-26T04:49:31Z</dc:date>
    <item>
      <title>Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398707#M3506</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have run the following codes fro days yet I could not get the result that i have been expecting.&lt;BR /&gt;The result that I had been expecting are more than 1 rows and yet it only stay as 1 rows despite the status of other rows are not in any of the above.&lt;BR /&gt;Please provide me with insights.&lt;BR /&gt;Thank you.&lt;BR /&gt;**Attached is the sas file that I had been running.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 03:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398707#M3506</guid>
      <dc:creator>Wken1122</dc:creator>
      <dc:date>2017-09-26T03:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398713#M3507</link>
      <description>&lt;P&gt;Post your program as text into the forum directly please.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 03:34:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398713#M3507</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-26T03:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398714#M3508</link>
      <description>&lt;P&gt;%INCLUDE "/folders/myfolders/Folder1/sasmacro/array.sas";&lt;BR /&gt;%INCLUDE "/folders/myfolders/Folder1/sasmacro/do_over.sas";&lt;/P&gt;&lt;P&gt;%LET LIB_SOURCE=CH_P02_SOURCE_5;&lt;BR /&gt;%LET LIB_ODSCLAIM=DM_BASE.ODS_CLAIM;&lt;/P&gt;&lt;P&gt;DATA ODS_CLAIM;&lt;BR /&gt;SET ODS_CLAIM;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE CLAIMS_DETAILS AS&lt;BR /&gt;(&lt;BR /&gt;SELECT ID AS CLAIMID,ODS_CLAIM.POLICYNUMBER,PRODUCTC,CLAIMNUMBER,CLAIMNOTIFIEDDATE,STATUS,OCCURENCEDATE,LOSSTYPE,&lt;BR /&gt;TOTALPAIDAMOUNT,INTIMATEDDATE,DATEADMITTED,DATEDISCHARGED,&lt;BR /&gt;DATEAPPROVED,LOSSDESCRIPTION,TRANSACTIONNUMBER,APPROVEDAMOUNT,&lt;BR /&gt;LOSSDESCRIPTIONCODE,CLAIMENTRYDATE,CAUSEOFEVENTCODE,CLOSEDATE,LOSSDATE,ILLNESSCODE,ILLNESS&lt;/P&gt;&lt;P&gt;FROM ODS_CLAIM, (SELECT DISTINCT (POLICYNUMBER) FROM CH_P02_SOURCE_5) TEMP&lt;BR /&gt;Where ODS_CLAIM.POLICYNUMBER=TEMP.POLICYNUMBER&lt;BR /&gt;and STATUS NOT IN ('Cancelled','Decline','Rejected'&lt;BR /&gt;,'Pending Assessment','Pending Authorization','Pending Documents')&lt;BR /&gt;)&lt;BR /&gt;;RUN; QUIT;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 03:37:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398714#M3508</guid>
      <dc:creator>Wken1122</dc:creator>
      <dc:date>2017-09-26T03:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398716#M3509</link>
      <description>&lt;P&gt;Can you post a PROC FREQ output from the STATUS column?&amp;nbsp;And the FULL log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And does the following change the results at all?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL ;
	CREATE TABLE CLAIMS_DETAILS AS
   SELECT ID AS CLAIMID, ODS_CLAIM.POLICYNUMBER, 
	PRODUCTC, CLAIMNUMBER,CLAIMNOTIFIEDDATE, STATUS, OCCURENCEDATE, LOSSTYPE, TOTALPAIDAMOUNT, 
		INTIMATEDDATE, DATEADMITTED, DATEDISCHARGED, DATEAPPROVED, LOSSDESCRIPTION, 
		TRANSACTIONNUMBER, APPROVEDAMOUNT, LOSSDESCRIPTIONCODE, CLAIMENTRYDATE, 
		CAUSEOFEVENTCODE, CLOSEDATE, LOSSDATE, ILLNESSCODE, ILLNESS 
		
		FROM ODS_CLAIM full join 
		(SELECT DISTINCT (POLICYNUMBER) FROM CH_P02_SOURCE_5) as TEMP 
		on 
		ODS_CLAIM.POLICYNUMBER=TEMP.POLICYNUMBER 
		where STATUS NOT IN ('Cancelled', 'Decline', 'Rejected', 'Pending Assessment', 'Pending Authorization', 'Pending Documents') ;

QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 03:42:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398716#M3509</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-26T03:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398718#M3510</link>
      <description>&lt;P&gt;It is impossible to check your code without having the input (test) data and the macro source code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest:&lt;/P&gt;
&lt;P&gt;1) check the log and locate the first step output with one row. Is it logic ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Some intermediate output may have one row. Isn't it ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Beyond:&lt;/P&gt;
&lt;P&gt;1) Remark last step of PROC DELETE and rerun in order to have the intermediate datasets in work.&lt;/P&gt;
&lt;P&gt;2) Check step by step output to locate first step suspicious output and recheck the code logic.&lt;/P&gt;
&lt;P&gt;3) When you find a suspicious step, add some PUT statements and add info to the log ang debug it.&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Recheck the log. If need change your step code and rerun that step until you feel it is ok.&lt;/P&gt;
&lt;P&gt;4) Do the same recechecking on every suspicios step, up to the last.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Finally rerun the full updated code and check results.&lt;/P&gt;
&lt;P&gt;5) Unmark the PROC DELETE step and save the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this help you?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 03:57:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398718#M3510</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-09-26T03:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398720#M3511</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;The full join does not make any changes.&lt;BR /&gt;Attached is the requested files.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 04:06:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398720#M3511</guid>
      <dc:creator>Wken1122</dc:creator>
      <dc:date>2017-09-26T04:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398721#M3512</link>
      <description>&lt;P&gt;I will give it a try. Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 04:13:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398721#M3512</guid>
      <dc:creator>Wken1122</dc:creator>
      <dc:date>2017-09-26T04:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398722#M3513</link>
      <description>&lt;P&gt;There's errors in your log. Fix the steps with the errors first - you truncated the log so I can't say where.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT - the full log is there, didn't show in preview for some reason. Please do not use attachement but post things directly into the forum.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's easier to work with. The answers the same still though, your SQL query has a syntax error, I think you need the word AS for the alias.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fix that, and you'll likely at least be one step further. &amp;nbsp;If there's an error in your log it helps if you state that at the start and include it, rather than us having to ask for it. And always read the log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 04:49:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398722#M3513</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-26T04:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398724#M3514</link>
      <description>OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt;NOTE: ODS statements in the SAS Studio environment may disable some output features.&lt;BR /&gt;62&lt;BR /&gt;63 %INCLUDE "/folders/myfolders/Folder1/sasmacro/array.sas";&lt;BR /&gt;219 %INCLUDE "/folders/myfolders/Folder1/sasmacro/do_over.sas";&lt;BR /&gt;459&lt;BR /&gt;460 %LET LIB_SOURCE=CH_P02_SOURCE_5;&lt;BR /&gt;461 %LET LIB_ODSCLAIM=DM_BASE.ODS_CLAIM;&lt;BR /&gt;462&lt;BR /&gt;463 DATA ODS_CLAIM;&lt;BR /&gt;464 SET ODS_CLAIM;&lt;BR /&gt;465 RUN;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 220 observations read from the data set WORK.ODS_CLAIM.&lt;BR /&gt;NOTE: The data set WORK.ODS_CLAIM has 220 observations and 107 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;466&lt;BR /&gt;467 PROC SQL;&lt;BR /&gt;468 CREATE TABLE CLAIMS_DETAILS AS&lt;BR /&gt;469 (&lt;BR /&gt;470 SELECT ID AS CLAIMID,ODS_CLAIM.POLICYNUMBER,PRODUCTC,CLAIMNUMBER,CLAIMNOTIFIEDDATE,STATUS,OCCURENCEDATE,LOSSTYPE,&lt;BR /&gt;471 TOTALPAIDAMOUNT,INTIMATEDDATE,DATEADMITTED,DATEDISCHARGED,&lt;BR /&gt;472 DATEAPPROVED,LOSSDESCRIPTION,TRANSACTIONNUMBER,APPROVEDAMOUNT,&lt;BR /&gt;473 LOSSDESCRIPTIONCODE,CLAIMENTRYDATE,CAUSEOFEVENTCODE,CLOSEDATE,LOSSDATE,ILLNESSCODE,ILLNESS&lt;BR /&gt;474&lt;BR /&gt;475 FROM ODS_CLAIM, (SELECT DISTINCT(POLICYNUMBER) FROM &amp;amp;LIB_SOURCE.) TEMP&lt;BR /&gt;476 WHERE ODS_CLAIM.POLICYNUMBER=TEMP.POLICYNUMBER&lt;BR /&gt;477 AND STATUS NOT IN ('Cancelled','Decline','Rejected'&lt;BR /&gt;478 ,'Pending Assessment','Pending Authorization','Pending Documents')&lt;BR /&gt;479 )&lt;BR /&gt;480 ;&lt;BR /&gt;NOTE: Table WORK.CLAIMS_DETAILS created, with 1 rows and 23 columns.&lt;BR /&gt;&lt;BR /&gt;480 ! RUN; QUIT;&lt;BR /&gt;NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;481&lt;BR /&gt;482 DATA CLAIMS_DETAILS;&lt;BR /&gt;483 SET CLAIMS_DETAILS;&lt;BR /&gt;484 FORMAT LAST1M LAST3M LAST6M LAST12M LAST18M LAST24M LAST60M LAST120M DATE9.;&lt;BR /&gt;485 LAST1M=DATEPART(DATEADMITTED)-30;&lt;BR /&gt;486 LAST3M=DATEPART(DATEADMITTED)-90;&lt;BR /&gt;487 LAST6M=DATEPART(DATEADMITTED)-180;&lt;BR /&gt;488 LAST12M=DATEPART(DATEADMITTED)-(12*30);&lt;BR /&gt;489 LAST18M=DATEPART(DATEADMITTED)-(18*30);&lt;BR /&gt;490 LAST24M=DATEPART(DATEADMITTED)-(24*30); /*2YEARS*/&lt;BR /&gt;491 LAST60M=DATEPART(DATEADMITTED)-(60*30); /*5YEARS*/&lt;BR /&gt;492 LAST120M=DATEPART(DATEADMITTED)-(120*30); /*10YEARS*/&lt;BR /&gt;493 CLAIM_HOSP_LOS= DATEPART(DATEDISCHARGED)-DATEPART(DATEADMITTED);&lt;BR /&gt;494 RUN;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 1 observations read from the data set WORK.CLAIMS_DETAILS.&lt;BR /&gt;NOTE: The data set WORK.CLAIMS_DETAILS has 1 observations and 32 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;495&lt;BR /&gt;496 /*&lt;BR /&gt;497 PROC FREQ DATA=CLAIMS_DETAILS NOPRINT;&lt;BR /&gt;498 TABLE STATUS/OUT=STATUS;&lt;BR /&gt;499 RUN;&lt;BR /&gt;500 */&lt;BR /&gt;501&lt;BR /&gt;502 PROC SORT DATA=CLAIMS_DETAILS; BY POLICYNUMBER DATEADMITTED; RUN;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 1 observations read from the data set WORK.CLAIMS_DETAILS.&lt;BR /&gt;NOTE: The data set WORK.CLAIMS_DETAILS has 1 observations and 32 variables.&lt;BR /&gt;NOTE: PROCEDURE SORT used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;503&lt;BR /&gt;504 DATA CLAIMS_DETAILS_ALL(DROP=LAG_TOTALPAIDAMOUNT);&lt;BR /&gt;505 SET CLAIMS_DETAILS;&lt;BR /&gt;506 BY POLICYNUMBER;&lt;BR /&gt;507 RETAIN CLAIMCNT_ALLPAST CLAIMAMT_ALLPAST;&lt;BR /&gt;508 LAG_TOTALPAIDAMOUNT=LAG(TOTALPAIDAMOUNT);&lt;BR /&gt;509 IF FIRST.POLICYNUMBER THEN&lt;BR /&gt;510 DO;&lt;BR /&gt;511 CLAIMCNT_ALLPAST=0;&lt;BR /&gt;512 CLAIMAMT_ALLPAST=0;&lt;BR /&gt;513 LAG_TOTALPAIDAMOUNT=0;&lt;BR /&gt;514 END;&lt;BR /&gt;515 ELSE&lt;BR /&gt;516 DO;&lt;BR /&gt;517 CLAIMCNT_ALLPAST=CLAIMCNT_ALLPAST+1;&lt;BR /&gt;518 CLAIMAMT_ALLPAST=CLAIMAMT_ALLPAST+LAG_TOTALPAIDAMOUNT;&lt;BR /&gt;519 END;&lt;BR /&gt;520 RUN;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 1 observations read from the data set WORK.CLAIMS_DETAILS.&lt;BR /&gt;NOTE: The data set WORK.CLAIMS_DETAILS_ALL has 1 observations and 34 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;521&lt;BR /&gt;522 %MACRO DOCLAIMSUM(MTH);&lt;BR /&gt;523 PROC SQL;&lt;BR /&gt;524 CREATE TABLE CLAIMS_DETAILS_&amp;amp;MTH.M AS&lt;BR /&gt;525 (&lt;BR /&gt;526 SELECT LTAB.POLICYNUMBER,LTAB.CLAIMID, LTAB.DATEADMITTED&lt;BR /&gt;527 , COUNT(DISTINCT RTAB.DATEADMITTED) AS CLAIMCNT_LAST&amp;amp;MTH.M, SUM(RTAB.TOTALPAIDAMOUNT) AS CLAIMAMT_LAST&amp;amp;MTH.M&lt;BR /&gt;528 FROM CLAIMS_DETAILS_ALL LTAB&lt;BR /&gt;529 LEFT JOIN CLAIMS_DETAILS_ALL RTAB&lt;BR /&gt;530 ON LTAB.POLICYNUMBER=RTAB.POLICYNUMBER AND LTAB.LAST&amp;amp;MTH.M&amp;lt;=RTAB.DATEADMITTED&amp;lt; LTAB.DATEADMITTED /*if the prevous&lt;BR /&gt;530 ! admitted date is in betwehh x month from now*/&lt;BR /&gt;531 GROUP BY LTAB.POLICYNUMBER,LTAB.CLAIMID,LTAB.DATEADMITTED&lt;BR /&gt;532 ); RUN; QUIT;&lt;BR /&gt;533 %MEND;&lt;BR /&gt;534&lt;BR /&gt;535 %DO_OVER(VALUES=1 3 6 12 18 24 60 120, MACRO=DOCLAIMSUM); RUN; QUIT;&lt;BR /&gt;NOTE: Table WORK.CLAIMS_DETAILS_1M created, with 1 rows and 5 columns.&lt;BR /&gt;&lt;BR /&gt;NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: Table WORK.CLAIMS_DETAILS_3M created, with 1 rows and 5 columns.&lt;BR /&gt;&lt;BR /&gt;NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: Table WORK.CLAIMS_DETAILS_6M created, with 1 rows and 5 columns.&lt;BR /&gt;&lt;BR /&gt;NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: Table WORK.CLAIMS_DETAILS_12M created, with 1 rows and 5 columns.&lt;BR /&gt;&lt;BR /&gt;NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.02 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: Table WORK.CLAIMS_DETAILS_18M created, with 1 rows and 5 columns.&lt;BR /&gt;&lt;BR /&gt;NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.02 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: Table WORK.CLAIMS_DETAILS_24M created, with 1 rows and 5 columns.&lt;BR /&gt;&lt;BR /&gt;NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.02 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: Table WORK.CLAIMS_DETAILS_60M created, with 1 rows and 5 columns.&lt;BR /&gt;&lt;BR /&gt;NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: Table WORK.CLAIMS_DETAILS_120M created, with 1 rows and 5 columns.&lt;BR /&gt;&lt;BR /&gt;NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;536&lt;BR /&gt;537&lt;BR /&gt;538 PROC SQL;&lt;BR /&gt;539&lt;BR /&gt;540 CREATE TABLE CLAIMS_DETAILS_FINAL AS&lt;BR /&gt;541 (&lt;BR /&gt;542 SELECT TAB.*,CLAIMCNT_ALLPAST,CLAIMAMT_ALLPAST&lt;BR /&gt;543 ,CLAIMCNT_LAST1M,CLAIMAMT_LAST1M&lt;BR /&gt;544 ,CLAIMCNT_LAST3M,CLAIMAMT_LAST3M&lt;BR /&gt;545 ,CLAIMCNT_LAST6M,CLAIMAMT_LAST6M&lt;BR /&gt;546 ,CLAIMCNT_LAST12M,CLAIMAMT_LAST12M&lt;BR /&gt;547 ,CLAIMCNT_LAST18M,CLAIMAMT_LAST18M&lt;BR /&gt;548 ,CLAIMCNT_LAST24M,CLAIMAMT_LAST24M&lt;BR /&gt;549 ,CLAIMCNT_LAST60M,CLAIMAMT_LAST60M&lt;BR /&gt;550 ,CLAIMCNT_LAST120M,CLAIMAMT_LAST120M&lt;BR /&gt;551 FROM CLAIMS_DETAILS TAB&lt;BR /&gt;552 LEFT JOIN CLAIMS_DETAILS_ALL TABSUM&lt;BR /&gt;553 ON TAB.POLICYNUMBER=TABSUM.POLICYNUMBER&lt;BR /&gt;554 AND TAB.CLAIMID=TABSUM.CLAIMID&lt;BR /&gt;555 AND TAB.DATEADMITTED=TABSUM.DATEADMITTED&lt;BR /&gt;556 LEFT JOIN CLAIMS_DETAILS_1M TAB1M&lt;BR /&gt;557 ON TAB.POLICYNUMBER=TAB1M.POLICYNUMBER&lt;BR /&gt;558 AND TAB.CLAIMID=TAB1M.CLAIMID&lt;BR /&gt;559 AND TAB.DATEADMITTED=TAB1M.DATEADMITTED&lt;BR /&gt;560 LEFT JOIN CLAIMS_DETAILS_3M TAB3M&lt;BR /&gt;561 ON TAB.POLICYNUMBER=TAB3M.POLICYNUMBER&lt;BR /&gt;562 AND TAB.CLAIMID=TAB3M.CLAIMID&lt;BR /&gt;563 AND TAB.DATEADMITTED=TAB3M.DATEADMITTED&lt;BR /&gt;564 LEFT JOIN CLAIMS_DETAILS_6M TAB6M&lt;BR /&gt;565 ON TAB.POLICYNUMBER=TAB6M.POLICYNUMBER&lt;BR /&gt;566 AND TAB.CLAIMID=TAB6M.CLAIMID&lt;BR /&gt;567 AND TAB.DATEADMITTED=TAB6M.DATEADMITTED&lt;BR /&gt;568 LEFT JOIN CLAIMS_DETAILS_12M TAB12M&lt;BR /&gt;569 ON TAB.POLICYNUMBER=TAB12M.POLICYNUMBER&lt;BR /&gt;570 AND TAB.CLAIMID=TAB12M.CLAIMID&lt;BR /&gt;571 AND TAB.DATEADMITTED=TAB12M.DATEADMITTED&lt;BR /&gt;572 LEFT JOIN CLAIMS_DETAILS_18M TAB18M&lt;BR /&gt;573 ON TAB.POLICYNUMBER=TAB18M.POLICYNUMBER&lt;BR /&gt;574 AND TAB.CLAIMID=TAB18M.CLAIMID&lt;BR /&gt;575 AND TAB.DATEADMITTED=TAB18M.DATEADMITTED&lt;BR /&gt;576 LEFT JOIN CLAIMS_DETAILS_24M TAB24M&lt;BR /&gt;577 ON TAB.POLICYNUMBER=TAB24M.POLICYNUMBER&lt;BR /&gt;578 AND TAB.CLAIMID=TAB24M.CLAIMID&lt;BR /&gt;579 AND TAB.DATEADMITTED=TAB24M.DATEADMITTED&lt;BR /&gt;580 LEFT JOIN CLAIMS_DETAILS_60M TAB60M&lt;BR /&gt;581 ON TAB.POLICYNUMBER=TAB60M.POLICYNUMBER&lt;BR /&gt;582 AND TAB.CLAIMID=TAB60M.CLAIMID&lt;BR /&gt;583 AND TAB.DATEADMITTED=TAB60M.DATEADMITTED&lt;BR /&gt;584 LEFT JOIN CLAIMS_DETAILS_120M TAB120M&lt;BR /&gt;585 ON TAB.POLICYNUMBER=TAB120M.POLICYNUMBER&lt;BR /&gt;586 AND TAB.CLAIMID=TAB120M.CLAIMID&lt;BR /&gt;587 AND TAB.DATEADMITTED=TAB120M.DATEADMITTED&lt;BR /&gt;588 )&lt;BR /&gt;589&lt;BR /&gt;590 ;&lt;BR /&gt;NOTE: Table WORK.CLAIMS_DETAILS_FINAL created, with 1 rows and 50 columns.&lt;BR /&gt;&lt;BR /&gt;591 RUN;QUIT;&lt;BR /&gt;NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.02 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;592&lt;BR /&gt;593 /*ALSO INCLUDE THE LATEST ONE*/&lt;BR /&gt;594 DATA CLAIMS_DETAILS;&lt;BR /&gt;595 SET CLAIMS_DETAILS_FINAL;&lt;BR /&gt;596 %DO_OVER(VALUES=1 3 6 12 18 24 60 120,&lt;BR /&gt;597 PHRASE=IF MISSING(CLAIMAMT_LAST?M) THEN CLAIMAMT_LAST?M=0;&lt;BR /&gt;598 CLAIMCNT_LAST?M=CLAIMCNT_LAST?M+1;&lt;BR /&gt;599 CLAIMAMT_LAST?M=CLAIMAMT_LAST?M+TOTALPAIDAMOUNT;);&lt;BR /&gt;600 CLAIMCNT_ALLPAST=CLAIMCNT_ALLPAST+1;&lt;BR /&gt;601 CLAIMAMT_ALLPAST=CLAIMAMT_ALLPAST+TOTALPAIDAMOUNT;&lt;BR /&gt;602 RUN;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 1 observations read from the data set WORK.CLAIMS_DETAILS_FINAL.&lt;BR /&gt;NOTE: The data set WORK.CLAIMS_DETAILS has 1 observations and 50 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;603&lt;BR /&gt;604 PROC DELETE DATA=ODS_CLAIM CLAIMS_DETAILS_FINAL CLAIMS_DETAILS_ALL CLAIMS_DETAILS_1M CLAIMS_DETAILS_3M CLAIMS_DETAILS_6M&lt;BR /&gt;605 CLAIMS_DETAILS_12M CLAIMS_DETAILS_18M CLAIMS_DETAILS_24M CLAIMS_DETAILS_60M CLAIMS_DETAILS_120M; RUN;&lt;BR /&gt;&lt;BR /&gt;NOTE: Deleting WORK.ODS_CLAIM (memtype=DATA).&lt;BR /&gt;NOTE: Deleting WORK.CLAIMS_DETAILS_FINAL (memtype=DATA).&lt;BR /&gt;NOTE: Deleting WORK.CLAIMS_DETAILS_ALL (memtype=DATA).&lt;BR /&gt;NOTE: Deleting WORK.CLAIMS_DETAILS_1M (memtype=DATA).&lt;BR /&gt;NOTE: Deleting WORK.CLAIMS_DETAILS_3M (memtype=DATA).&lt;BR /&gt;NOTE: Deleting WORK.CLAIMS_DETAILS_6M (memtype=DATA).&lt;BR /&gt;NOTE: Deleting WORK.CLAIMS_DETAILS_12M (memtype=DATA).&lt;BR /&gt;NOTE: Deleting WORK.CLAIMS_DETAILS_18M (memtype=DATA).&lt;BR /&gt;NOTE: Deleting WORK.CLAIMS_DETAILS_24M (memtype=DATA).&lt;BR /&gt;NOTE: Deleting WORK.CLAIMS_DETAILS_60M (memtype=DATA).&lt;BR /&gt;NOTE: Deleting WORK.CLAIMS_DETAILS_120M (memtype=DATA).&lt;BR /&gt;NOTE: PROCEDURE DELETE used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;606&lt;BR /&gt;607&lt;BR /&gt;608&lt;BR /&gt;609 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt;622&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Sep 2017 05:55:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398724#M3514</guid>
      <dc:creator>Wken1122</dc:creator>
      <dc:date>2017-09-26T05:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398729#M3515</link>
      <description>&lt;P&gt;Sadly as someone else has mentioned we can't help without the data now.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code works, now, but the logic is wrong, since we don't know the logic you want, or the data you have and the code runs....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would start with a couple of things - your first data step does nothing. Is that correct/expected?&lt;/P&gt;
&lt;P&gt;Check the variable length for policy number, is it the same in both data sets? Are they character or numeric? If character does it have letter on both cases?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remove the status filter in the query and see what the results are?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 06:19:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398729#M3515</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-26T06:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398738#M3516</link>
      <description>Ok then, I will give it a try...&lt;BR /&gt;Thanks a lot for all your quick reply.</description>
      <pubDate>Tue, 26 Sep 2017 07:29:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398738#M3516</guid>
      <dc:creator>Wken1122</dc:creator>
      <dc:date>2017-09-26T07:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398787#M3518</link>
      <description>&lt;P&gt;Checking your log:&lt;/P&gt;
&lt;P&gt;First step resulted in 220 observations. The next step result with 1 observation only.&lt;/P&gt;
&lt;P&gt;Is that fit your expectations?&lt;/P&gt;
&lt;P&gt;Focus on the log lines numbered 467 - 480.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check again your data - ODS_CLAIM dataset:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try to run with part of the selection conditions:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WHERE ODS_CLAIM.POLICYNUMBER=TEMP.POLICYNUMBER&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(without checking STATUS). What statuses you have in the output? how many fit your second condition?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We may fail with logic or with the code.&lt;/P&gt;
&lt;P&gt;Check your logic accrding to code and vice versa.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 13:08:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398787#M3518</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-09-26T13:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398998#M3525</link>
      <description>&lt;P&gt;On second step there should have more than 1 row fits the criteria but unsure why it only shows a single row.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 01:48:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/398998#M3525</guid>
      <dc:creator>Wken1122</dc:creator>
      <dc:date>2017-09-27T01:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/399013#M3527</link>
      <description>&lt;P&gt;I genuinely suspect your first data step is logically incorrect. I suspect you should be sourcing the data from a library? Perhaps the one assigned in the macro variable.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 03:27:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/399013#M3527</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-27T03:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/399014#M3528</link>
      <description>&lt;P&gt;Run next code and post your output as text:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET lib_source =  ...;  /* copmlete this statement ! */&lt;BR /&gt;&lt;BR /&gt;PROC SQL;
    CREATE TABLE CLAIMS_DETAILS AS
    ( SELECT  ID AS CLAIMID,
                     ODS_CLAIM.POLICYNUMBER,
                     PRODUCTC,
                     CLAIMNUMBER,
                     CLAIMNOTIFIEDDATE,
                     STATUS,
                     OCCURENCEDATE,
                     LOSSTYPE,
                     TOTALPAIDAMOUNT,
                     INTIMATEDDATE,
                     DATEADMITTED,
                     DATEDISCHARGED,
                     DATEAPPROVED,
                     LOSSDESCRIPTION,
                     TRANSACTIONNUMBER,
                     APPROVEDAMOUNT,
                     LOSSDESCRIPTIONCODE,
                     CLAIMENTRYDATE,
                     CAUSEOFEVENTCODE,
                     CLOSEDATE,
                     LOSSDATE,
                     ILLNESSCODE,
                     ILLNESS

FROM ODS_CLAIM,
         (SELECT DISTINCT(POLICYNUMBER) FROM &amp;amp;LIB_SOURCE.) 
          as TEMP
WHERE ODS_CLAIM.POLICYNUMBER=TEMP.POLICYNUMBER
/*******
AND STATUS NOT IN ('Cancelled','Decline','Rejected'
					,'Pending Assessment','Pending Authorization','Pending Documents')
*******/
       );
QUIT;

PROC PRINT DATA=CLAIMS_DETAILS;
   var  STATUS ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Sep 2017 04:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/399014#M3528</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-09-27T04:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/399018#M3529</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;Is that missing a semicolon at the end?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 04:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/399018#M3529</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-27T04:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/399022#M3530</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, thank you, you are right.&lt;/P&gt;
&lt;P&gt;I have edied the code and fixed it.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 04:36:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/399022#M3530</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-09-27T04:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: Result generated are different from expectation.</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/399044#M3532</link>
      <description>&lt;P&gt;It still displays only a row.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 06:30:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Result-generated-are-different-from-expectation/m-p/399044#M3532</guid>
      <dc:creator>Wken1122</dc:creator>
      <dc:date>2017-09-27T06:30:40Z</dc:date>
    </item>
  </channel>
</rss>

