<?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 first. = . repedetively in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45913#M12142</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@ART&lt;/P&gt;&lt;P&gt;DO OVER?!&lt;/P&gt;&lt;P&gt;You definitely started with SAS some years ago. I believe DO OVER was already marked as "obsolete" in SAS V6 :smileylaugh:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In modern SAS you could write it with no explicit loop at all:&lt;/P&gt;&lt;P&gt;call missing(of _numeric_);&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 04 Feb 2012 03:28:26 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2012-02-04T03:28:26Z</dc:date>
    <item>
      <title>using first. = . repedetively</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45904#M12133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have 3 first. criteria to use, but I must use ot on 14 different variables... is there a easy way to do this&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if first.YEAR then price_GR=.;&lt;/P&gt;&lt;P&gt;if first.Type then price_GR=.; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if first.Store then price_GR=.;&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;P&gt;﻿I have 14 different price_GR=.;&amp;nbsp; (eg. UN_GR, GDP_GR, etc.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;﻿Cant have 14 series of the first.YEAR, first.Type and first.Store .. Is there a easy way to make them repedetive rather than type each out?&amp;nbsp; thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 21:02:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45904#M12133</guid>
      <dc:creator>podarum</dc:creator>
      <dc:date>2012-02-03T21:02:36Z</dc:date>
    </item>
    <item>
      <title>using first. = . repedetively</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45905#M12134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure what you are trying to do.&amp;nbsp; You can always specify them as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if first.YEAR then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; price_GR=.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp; etc.&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if first.Type then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp; etc.&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also load your data into an array and, rather than have 14 statements, just refer to the variables in the array.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 21:08:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45905#M12134</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-03T21:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: using first. = . repedetively</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45906#M12135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;Not sure if this is what you are looking for. Regards, Udo&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;proc sort data=sashelp.class out=have;&lt;/P&gt;&lt;P&gt;by sex age;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if first.sex then call missing(sex,age,height,weight);&lt;/P&gt;&lt;P&gt;if first.age then call missing(sex,age,height,weight);&lt;/P&gt;&lt;P&gt;by sex age;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 21:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45906#M12135</guid>
      <dc:creator>udo_sas</dc:creator>
      <dc:date>2012-02-03T21:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: using first. = . repedetively</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45907#M12136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let me try to explain it better:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there better way to write this? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if first.YEAR then price_GR=.; &lt;/P&gt;&lt;P&gt;if first.Type then price_GR=.; &lt;/P&gt;&lt;P&gt;if first.Store then price_GR=.; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if first.YEAR then UN_GR=.; &lt;/P&gt;&lt;P&gt;if first.Type then UN_GR=.; &lt;/P&gt;&lt;P&gt;if first.Store then UN_GR=.; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if first.YEAR then GDP_GR=.; &lt;/P&gt;&lt;P&gt;if first.Type then GDP_GR=.; &lt;/P&gt;&lt;P&gt;if first.Store then GDP_GR=.; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and so on 14 times with 14 different VARS_GR.... Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 21:20:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45907#M12136</guid>
      <dc:creator>podarum</dc:creator>
      <dc:date>2012-02-03T21:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: using first. = . repedetively</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45908#M12137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do those variables already exist and you just want them reset to missing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 21:22:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45908#M12137</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-03T21:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: using first. = . repedetively</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45909#M12138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 21:24:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45909#M12138</guid>
      <dc:creator>podarum</dc:creator>
      <dc:date>2012-02-03T21:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: using first. = . repedetively</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45910#M12139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is an example of how you could do it for, say, all numeric variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=sashelp.class out=test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by age;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array vars _numeric_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by age;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.age then do over vars;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call missing(vars);&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 21:26:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45910#M12139</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-03T21:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: using first. = . repedetively</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45911#M12140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;by year type store ;&lt;/P&gt;&lt;P&gt;if first.store then call missing (UN_GR, GDP_GR, etc) ; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 23:00:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45911#M12140</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2012-02-03T23:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: using first. = . repedetively</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45912#M12141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As Howles has said already you do not need to test all of the higher level variables in the sort order.&amp;nbsp; If it the first for higher level term it also the first for the lower level term, by the definition of how FIRST. is calculated.&amp;nbsp; So it you just reset on the first. for the lowest level term it will also reset at the first for all of the higher level terms.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To reset a number of variables to missing use the call missing statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Feb 2012 00:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45912#M12141</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-02-04T00:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: using first. = . repedetively</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45913#M12142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@ART&lt;/P&gt;&lt;P&gt;DO OVER?!&lt;/P&gt;&lt;P&gt;You definitely started with SAS some years ago. I believe DO OVER was already marked as "obsolete" in SAS V6 :smileylaugh:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In modern SAS you could write it with no explicit loop at all:&lt;/P&gt;&lt;P&gt;call missing(of _numeric_);&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Feb 2012 03:28:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45913#M12142</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-02-04T03:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: using first. = . repedetively</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45914#M12143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Patrick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I started with SAS a long time ago.&amp;nbsp; In fact, before it became a company!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I still like using do over and don't know why they stopped including it in the documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, in this case, your suggestion is all that would be needed.&amp;nbsp; But not quite so easy for other assignments. Unfortunately, they never included a similar call assign (e.g., call (assign,3, of _numeric_);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Feb 2012 03:44:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/using-first-repedetively/m-p/45914#M12143</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-04T03:44:00Z</dc:date>
    </item>
  </channel>
</rss>

