<?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: First. understanding in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811090#M319918</link>
    <description>&lt;P&gt;It is only missing until the SUM statement executes.&amp;nbsp; Then it becomes 1 because SUM(.,1) is 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;POSTING_DT does not impact the group, just the ordering.&lt;/P&gt;
&lt;P&gt;So the generated CURVE_DAY values are generated in POSTING_DT order.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that if you have multiple observations for the same POSTING_DT value (within the other two grouping variables) they will each get a different value of CURVE_DAY.&amp;nbsp; Also if there are gaps in the values or POSTING_DT so that one or more dates are skipped the numbers assigned to CURVE_DAY will not reflect that gap.&amp;nbsp; So CURVE_DAY is not really a relative day value, but just a number you can use to order the values.&lt;/P&gt;</description>
    <pubDate>Mon, 02 May 2022 16:26:09 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-05-02T16:26:09Z</dc:date>
    <item>
      <title>First. understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811084#M319913</link>
      <description>&lt;P&gt;In the following code my understanding is to sort the input dataset by the provided variables. Curve_day value will be missing for the first curve value for the same combination of the variables PO, CURVE and POSTING_DT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can someone clarify&amp;nbsp; how the values of CURVE_DAY are 2,3 and 4 in the results as the POSTING_DT values are different in each record?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;DATA WORK.JAXMERGE;
     SET WORK.JAXMERGE;
     BY PO CURVE POSTNG_DT;
     IF FIRST.CURVE THEN CURVE_DAY = .;
     CURVE_DAY+1;
RUN;
&lt;/PRE&gt;
&lt;P&gt;Results:&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="First..jpg" style="width: 417px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71072i15B04A0AD9CDE52E/image-size/large?v=v2&amp;amp;px=999" role="button" title="First..jpg" alt="First..jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 15:34:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811084#M319913</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2022-05-02T15:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: First. understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811086#M319914</link>
      <description>&lt;P&gt;Because curve-day is reset at first.&lt;STRONG&gt;curve&lt;/STRONG&gt;, not at first.&lt;STRONG&gt;postng_dt&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 15:51:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811086#M319914</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-05-02T15:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: First. understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811087#M319915</link>
      <description>&lt;P&gt;In the program&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WORK.JAXMERGE;
     SET WORK.JAXMERGE;
     BY PO CURVE POSTNG_DT;
     IF FIRST.CURVE THEN CURVE_DAY = .;
     CURVE_DAY+1;
RUN&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you set CURVE_DAY to missing at the start of a CURVE&lt;/P&gt;
&lt;P&gt;but then you immediately incremented it by 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your syntax for the increment was to use a "summing statement", i.e.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;CURVE_DAY+1&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;which will treat a missing value for CURVE_DAY as a zero.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now if you want a missing, followed by 1,2,3 etc, you could&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WORK.JAXMERGE;
     SET WORK.JAXMERGE;
     BY PO CURVE POSTNG_DT;
     IF FIRST.CURVE THEN CURVE_DAY = .;
     else CURVE_DAY+1;
RUN&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 15:53:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811087#M319915</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-05-02T15:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: First. understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811088#M319916</link>
      <description>&lt;P&gt;You could answer these questions and more by adding to your DATA step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WORK.JAXMERGE;
     SET WORK.JAXMERGE;
     BY PO CURVE POSTNG_DT;
put 'Start:  ' curve_day=;
     IF FIRST.CURVE THEN CURVE_DAY = .;
put 'Middle:  ' curve_day=;
     CURVE_DAY+1;
put 'End:  ' curve_day=;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That way, you can inspect the value of CURVE_DAY at various points, as the programming statements execute.&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 15:59:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811088#M319916</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-05-02T15:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: First. understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811090#M319918</link>
      <description>&lt;P&gt;It is only missing until the SUM statement executes.&amp;nbsp; Then it becomes 1 because SUM(.,1) is 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;POSTING_DT does not impact the group, just the ordering.&lt;/P&gt;
&lt;P&gt;So the generated CURVE_DAY values are generated in POSTING_DT order.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that if you have multiple observations for the same POSTING_DT value (within the other two grouping variables) they will each get a different value of CURVE_DAY.&amp;nbsp; Also if there are gaps in the values or POSTING_DT so that one or more dates are skipped the numbers assigned to CURVE_DAY will not reflect that gap.&amp;nbsp; So CURVE_DAY is not really a relative day value, but just a number you can use to order the values.&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 16:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811090#M319918</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-02T16:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: First. understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811725#M320191</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;So in the following code we're doing operations as shown for first PO value and if it is last PO value, we just need to result it in output?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;DATA WORK.HAVE;
     SET WORK.HAVE;
     BY FISC_YR FISC_PD FISC_WK PO;
     IF FIRST.PO THEN DO;
           TOT = 0;
           CS_TOT = 0;
           LB_TOT = 0;
     END;
           ZNL_TOT +ZNL;
           CS_TOT +CS;
           LB_TOT +LB;
     IF LAST.PO;
RUN;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 May 2022 18:49:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811725#M320191</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2022-05-05T18:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: First. understanding</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811732#M320197</link>
      <description>&lt;P&gt;Maxim 4.&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 19:13:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-understanding/m-p/811732#M320197</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-05-05T19:13:23Z</dc:date>
    </item>
  </channel>
</rss>

