<?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: using if last. if first. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/using-if-last-if-first/m-p/871041#M344057</link>
    <description>&lt;P&gt;You got several methods yesterday? The last. / fist. variables are not suitable for this purpose. They indicate By-Group Boundaries, not the end of an entire data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From yesterday:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   set sashelp.baseball end = z;
   if NHITS &amp;gt; n then n = NHITS;
   if z then call symputx('maxNHITS', n);
   retain n;
run;

%put &amp;amp;maxNHITS.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 21 Apr 2023 08:17:11 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2023-04-21T08:17:11Z</dc:date>
    <item>
      <title>using if last. if first.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-if-last-if-first/m-p/871038#M344054</link>
      <description>&lt;P&gt;Can i create&amp;nbsp;a macro variable that will keep the largest value of NHITS from SASHELP.BASEBALL dataset using If Last. ?&lt;/P&gt;&lt;P&gt;i guess i am doing something wrong in my code above&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data baseball_1;&lt;BR /&gt;set sashelp.baseball;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=baseball_1;&lt;BR /&gt;by name nhits;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data m;&lt;BR /&gt;set Baseball_1;&lt;BR /&gt;by name;&lt;BR /&gt;if last.name then n=1;&lt;BR /&gt;call symputx('maxnhits', n);&lt;BR /&gt;proc print;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 07:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-if-last-if-first/m-p/871038#M344054</guid>
      <dc:creator>kindbe17</dc:creator>
      <dc:date>2023-04-21T07:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: using if last. if first.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-if-last-if-first/m-p/871039#M344055</link>
      <description>&lt;P&gt;Do you want the overall max in a macro variable or the max by some group?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 08:05:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-if-last-if-first/m-p/871039#M344055</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2023-04-21T08:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: using if last. if first.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-if-last-if-first/m-p/871040#M344056</link>
      <description>&lt;P&gt;i just want to create a macro variable that will keep the largest value of nhits, i think that value is 238 value from nhits variable, i dont know how to do that&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 08:13:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-if-last-if-first/m-p/871040#M344056</guid>
      <dc:creator>kindbe17</dc:creator>
      <dc:date>2023-04-21T08:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: using if last. if first.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-if-last-if-first/m-p/871041#M344057</link>
      <description>&lt;P&gt;You got several methods yesterday? The last. / fist. variables are not suitable for this purpose. They indicate By-Group Boundaries, not the end of an entire data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From yesterday:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   set sashelp.baseball end = z;
   if NHITS &amp;gt; n then n = NHITS;
   if z then call symputx('maxNHITS', n);
   retain n;
run;

%put &amp;amp;maxNHITS.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Apr 2023 08:17:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-if-last-if-first/m-p/871041#M344057</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2023-04-21T08:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: using if last. if first.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-if-last-if-first/m-p/871042#M344058</link>
      <description>&lt;P&gt;i thought i will be able to use if last. too, now i got it, thank you so much.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 08:18:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-if-last-if-first/m-p/871042#M344058</guid>
      <dc:creator>kindbe17</dc:creator>
      <dc:date>2023-04-21T08:18:40Z</dc:date>
    </item>
  </channel>
</rss>

