<?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: Question about lagging! in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629657#M20765</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285053"&gt;@accintron&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So I've tested everything everyone has mentioned with no success.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;They've all seemed to do the same thing, and what keeps getting lagged is the prv_unit_id from the previous CLIENT_MASTER_ID, not from the one it should be lagging.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Another issue is possibly your reuse of the same data set for source an output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data&lt;STRONG&gt; readm_same_fac;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set &lt;STRONG&gt;readm_same_fac;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have added those incorrect values they will stay there until you remove them because you continue to reuse the modified erroneous data as input.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest that you go back to the step that built your READM_SAME_FAC data set the very first time.&lt;/P&gt;
&lt;P&gt;Then modify your code to use a different output data set name to check the results.&lt;/P&gt;
&lt;P&gt;AND show us the actual code that you used that did not work if that happens.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is one of the reasons that we will often suggest not using the&lt;/P&gt;
&lt;P&gt;data readm_same_fac;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set readm_same_fac;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;code structure until you have a LOT of experience with what can go wrong.&lt;/P&gt;</description>
    <pubDate>Wed, 04 Mar 2020 23:43:03 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-03-04T23:43:03Z</dc:date>
    <item>
      <title>Question about lagging!</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629499#M20750</link>
      <description>&lt;P&gt;I am STUMPED!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I sorted my data by descending num_readm as I am trying to lag the last prv_unit_id to be the readm_unit per CLIENT_MASTER_ID if applicable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;here's my code:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=readm_same_fac;&lt;BR /&gt;by CLIENT_MASTER_ID descending NUM_READM ;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data readm_same_fac;&lt;BR /&gt;set readm_same_fac;&lt;/P&gt;
&lt;P&gt;by CLIENT_MASTER_ID descending NUM_READM;&lt;BR /&gt;if first.CLIENT_MASTER_ID and NUM_READM&amp;gt;1 then READM_UNIT=lag(PRV_UNIT_ID);&lt;BR /&gt;if NUM_READM=1 then READM_UNIT=.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The result is the following: (the highlighted rows are pairs where there were 2 readmissions for the patient in desc. order). The prv_unit_id from the last pair is being lagged to the first of the next pair.... How do I fix this to be that for someone who has more than 1 readm, the first prv_unit_id is lagged onto the second record here?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 506px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36591iC79A07C1C9EB70AA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance!!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 17:07:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629499#M20750</guid>
      <dc:creator>accintron</dc:creator>
      <dc:date>2020-03-04T17:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Question about lagging!</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629502#M20751</link>
      <description>&lt;P&gt;LAG and DIF are queued functions and when used in an IF then the LAG referenced will be the previous time the IF was true.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generally it is better to create the lagged values before any IF statement and then assign conditionally. Then drop the unwanted variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data readm_same_fac;
   set readm_same_fac;
   lpriv = lag(PRV_UNIT_ID);
   by CLIENT_MASTER_ID descending NUM_READM;
   if first.CLIENT_MASTER_ID and NUM_READM&amp;gt;1 then READM_UNIT= lpriv;
   if NUM_READM=1 then READM_UNIT=.;
   drop lpriv;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Mar 2020 17:13:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629502#M20751</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-04T17:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Question about lagging!</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629504#M20753</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285053"&gt;@accintron&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should never use the LAG function in a conditional statement as it underlies that the condition should be true for both current and prior observation.&lt;/P&gt;
&lt;P&gt;I suggest that you set the lag(value) first, and then specifies the conditions :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=readm_same_fac;
by CLIENT_MASTER_ID descending NUM_READM ;
run;
 
data readm_same_fac;
set readm_same_fac;
by CLIENT_MASTER_ID descending NUM_READM;

_lag = lag(PRV_UNIT_ID);

if first.CLIENT_MASTER_ID and NUM_READM&amp;gt;1 then READM_UNIT=_lag;
if NUM_READM=1 then READM_UNIT=.;&lt;BR /&gt;&lt;BR /&gt;drop _lag;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Mar 2020 17:16:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629504#M20753</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-03-04T17:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Question about lagging!</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629567#M20758</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285053"&gt;@accintron&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am STUMPED!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I sorted my data by descending num_readm as I am trying to lag the last prv_unit_id to be the readm_unit per CLIENT_MASTER_ID if applicable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;here's my code:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=readm_same_fac;&lt;BR /&gt;by CLIENT_MASTER_ID descending NUM_READM ;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data readm_same_fac;&lt;BR /&gt;set readm_same_fac;&lt;/P&gt;
&lt;P&gt;by CLIENT_MASTER_ID descending NUM_READM;&lt;BR /&gt;if first.CLIENT_MASTER_ID and NUM_READM&amp;gt;1 then READM_UNIT=lag(PRV_UNIT_ID);&lt;BR /&gt;if NUM_READM=1 then READM_UNIT=.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P style="box-sizing: inherit; color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 150%; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="box-sizing: inherit; color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 150%; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px;"&gt;You want a way the ALWAYS update the lag queue, but uses its results only conditionally.&amp;nbsp; The INF function is just what you need.&amp;nbsp; The firt argument is the test condition, the 2nd is the result if true, the 3rd is the result if not true.&amp;nbsp; But regardless of whether the test condition is true, &lt;EM&gt;&lt;STRONG&gt;BOTH THE SECOND AND THIRD ARGUMENTS ARE EVALUATED&lt;/STRONG&gt;&lt;/EM&gt;.&amp;nbsp; The means, somewhere in the background, the lag queue is ALWAYS updated, even if not always used.&lt;/P&gt;
&lt;P style="box-sizing: inherit; color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 150%; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="box-sizing: inherit; color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 150%; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px;"&gt;data readm_same_fac;&lt;BR style="box-sizing: inherit;" /&gt;&amp;nbsp; set readm_same_fac;&lt;/P&gt;
&lt;P style="box-sizing: inherit; color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 150%; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px;"&gt;&amp;nbsp; by CLIENT_MASTER_ID descending NUM_READM;&lt;/P&gt;
&lt;P style="box-sizing: inherit; color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 150%; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px;"&gt;&amp;nbsp; readm_unit=ifn(first.client_master_id=1 and num_readm&amp;gt;1,lag(prv_unit_id),.);&lt;BR style="box-sizing: inherit;" /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 19:24:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629567#M20758</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-03-04T19:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Question about lagging!</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629570#M20759</link>
      <description>&lt;P&gt;I've already provided a response in how to fix your program code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But are you sorting by descending only to get data from the next record by using LAG?&amp;nbsp; And will you be sorting the result in ascending order afterwards in order to get the original sequence?&amp;nbsp; If do, don't both.&amp;nbsp; Instead use&amp;nbsp;data step tools to look ahead - i.e. a simulated LEAD function.&amp;nbsp; In your case, I think it would be like this (untested):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data readm_same_fac (drop=_:);
  set readm_same_fac (keep=client_master_id num_readm);
  by CLIENT_MASTER_ID NUM_READM;
  merge readm_same_fac
        readm_same_fac (firstobs=2 keep=prv_unit_id rename=(prv_unit_id=_nxt_unit_id));

  if last.client_master_id and num_readm&amp;gt;1 then readm_unit=_nxt_unit_id;
  if num_readm=1 then readm_unit=.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 19:32:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629570#M20759</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-03-04T19:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Question about lagging!</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629576#M20761</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285053"&gt;@accintron&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should never use the LAG function in a conditional statement as it underlies that the condition should be true for both current and prior observation.&lt;/P&gt;
&lt;P&gt;I suggest that you set the lag(value) first, and then specifies the conditions :&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I understand the reason for this suggestion, but my response is&amp;nbsp; &lt;EM&gt;&lt;STRONG&gt;never-say-never&lt;/STRONG&gt;&lt;/EM&gt;.&amp;nbsp; Consider a dataset with one record per product per month, sorted by month.&amp;nbsp; Let's say the products are not consistently sorted within month. &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Say the user wants the monthly difference in same-product sales.&amp;nbsp; In that case an IF statement is exactly what is needed, as in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; if prod='A' then sales_dif=dif(sales);&amp;nbsp; else&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if prod='B' then sales_dif=dif(sales);&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; …&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This forms one DIF queue per product, which in turn works only because the LAG or DIF function is used in an IF statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This also helps when not all products are reported every month.&amp;nbsp; In that case the user might use this code, which forms one dif queue and one lag queue per product:&amp;nbsp;&lt;/P&gt;
&lt;P style="color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; if prod='A' then monthly_change=dif(sales)/&amp;nbsp; intck('month',lag(date),date); else&lt;/P&gt;
&lt;P style="color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; if prod='B' then monthly_change=dif(sales)/&amp;nbsp; intck('month',lag(date),date); else&lt;/P&gt;
&lt;P style="color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px;"&gt;&amp;nbsp;&amp;nbsp; if prod='C' then monthly_change=dif(sales)/&amp;nbsp; intck('month',lag(date),date);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 19:41:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629576#M20761</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-03-04T19:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Question about lagging!</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629578#M20762</link>
      <description>&lt;P&gt;So I've tested everything everyone has mentioned with no success.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;They've all seemed to do the same thing, and what keeps getting lagged is the prv_unit_id from the previous CLIENT_MASTER_ID, not from the one it should be lagging.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 19:42:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629578#M20762</guid>
      <dc:creator>accintron</dc:creator>
      <dc:date>2020-03-04T19:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: Question about lagging!</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629581#M20763</link>
      <description>&lt;P&gt;Then please make a SAS data step with the starting sample data, and then another one with the desired results.&amp;nbsp; I'm too lazy to take an image, convert it to ascii data, make a SAS program to read it, and finally test my program against that data.&amp;nbsp; Help us help you.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 19:45:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629581#M20763</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-03-04T19:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Question about lagging!</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629657#M20765</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285053"&gt;@accintron&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So I've tested everything everyone has mentioned with no success.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;They've all seemed to do the same thing, and what keeps getting lagged is the prv_unit_id from the previous CLIENT_MASTER_ID, not from the one it should be lagging.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Another issue is possibly your reuse of the same data set for source an output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data&lt;STRONG&gt; readm_same_fac;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set &lt;STRONG&gt;readm_same_fac;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have added those incorrect values they will stay there until you remove them because you continue to reuse the modified erroneous data as input.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest that you go back to the step that built your READM_SAME_FAC data set the very first time.&lt;/P&gt;
&lt;P&gt;Then modify your code to use a different output data set name to check the results.&lt;/P&gt;
&lt;P&gt;AND show us the actual code that you used that did not work if that happens.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is one of the reasons that we will often suggest not using the&lt;/P&gt;
&lt;P&gt;data readm_same_fac;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set readm_same_fac;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;code structure until you have a LOT of experience with what can go wrong.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 23:43:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Question-about-lagging/m-p/629657#M20765</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-04T23:43:03Z</dc:date>
    </item>
  </channel>
</rss>

