<?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. and last. statements in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/497559#M131904</link>
    <description>&lt;P&gt;First and Last variables are automatic variables that are not written to the output data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/234925"&gt;@clqa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;is the first. and last. statement temporary even though its in the data step?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Sep 2018 21:03:08 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-09-20T21:03:08Z</dc:date>
    <item>
      <title>first. and last. statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/497556#M131901</link>
      <description>&lt;P&gt;is the first. and last. statement temporary even though its in the data step?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 20:51:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/497556#M131901</guid>
      <dc:creator>clqa</dc:creator>
      <dc:date>2018-09-20T20:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: first. and last. statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/497558#M131903</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt; FIRST.&lt;STRONG&gt;&lt;EM&gt;byvar&lt;/EM&gt;&lt;/STRONG&gt; and LAST.&lt;STRONG&gt;&lt;EM&gt;byvar&lt;/EM&gt;&lt;/STRONG&gt; are automatic variables that exist for the duration of the DATA step program, but they can be used in the program. Since they are never output to the final dataset, you might consider them temporary. I prefer to think of them as automatic, like _N_ and _ERROR_, which are also available for the duration of the program but not output.&lt;BR /&gt;&lt;BR /&gt;So, FIRST. and LAST. are variables, not statements. When you use FIRST. and LAST. in a program, it is typically in some kind of IF statement like this:&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;if last.company then output;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;if first.department then dept_counter=0;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 21:02:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/497558#M131903</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-09-20T21:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: first. and last. statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/497559#M131904</link>
      <description>&lt;P&gt;First and Last variables are automatic variables that are not written to the output data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/234925"&gt;@clqa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;is the first. and last. statement temporary even though its in the data step?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 21:03:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/497559#M131904</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-20T21:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: first. and last. statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/497561#M131906</link>
      <description>Yes they are temporary variables created by SAS while processing the BY group staement in DATA step. These temporary variables are available for DATA step programming but are not added to the output data set.</description>
      <pubDate>Thu, 20 Sep 2018 21:05:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/497561#M131906</guid>
      <dc:creator>rahuljhaver</dc:creator>
      <dc:date>2018-09-20T21:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: first. and last. statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/497576#M131916</link>
      <description>&lt;P&gt;This is interesting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;32   data _null_;
33      first.sex = 30;
34      put _all_;
35      run;

first.sex=30 _ERROR_=0 _N_=1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Sep 2018 21:31:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/497576#M131916</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2018-09-20T21:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: first. and last. statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/497931#M132166</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Creating or using the variable in an assignment statement is not prohibited. But look what happens when you try to create a dataset:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="first_var_not_written.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23452iE7DA1F4C571F61B4/image-size/large?v=v2&amp;amp;px=999" role="button" title="first_var_not_written.png" alt="first_var_not_written.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;There are 2 assignment statements, but only 1 variable (X) is actually written to the output data -- the FIRST.SEX variable is NOT written to the output dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Fri, 21 Sep 2018 17:58:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/497931#M132166</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-09-21T17:58:07Z</dc:date>
    </item>
  </channel>
</rss>

