<?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: Does Lag function works in SAS University Edition??? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Does-Lag-function-works-in-SAS-University-Edition/m-p/307482#M65864</link>
    <description>&lt;P&gt;It looks like the editor you are using gives you a symbol that looks like a minus sign, but is really something else.&amp;nbsp; Just find the right symbol for a minus sign.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Oct 2016 20:19:09 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-10-26T20:19:09Z</dc:date>
    <item>
      <title>Does Lag function works in SAS University Edition???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-Lag-function-works-in-SAS-University-Edition/m-p/307470#M65856</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find the below code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA clinton_data;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INFILE '/folders/myfolders/Module10/clinton.txt' FIRSTOBS= 3 EXPANDTABS;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INPUT @7 Day 7-9 Mo $ 10-12 Year 14-17 Approve 24-25 Disapprove 32-33 No_opinion 40-41;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Temp_date = catx(" ",Day,Mo,Year);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Date = input(temp_date,DATE11.);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PUT Date = DATE11.;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FORMAT Date MMDDYY10.;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DROP Day Mo Year temp_date;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SORT DATA = clinton_data;&lt;BR /&gt;BY Date;&lt;BR /&gt;&lt;BR /&gt;DATA clinton_data1;&lt;BR /&gt;SET clinton_data;&lt;BR /&gt;FORMAT date MMDDYY10.;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;elapsed_time = (Date – (lag(Date)));&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;difference_approval = (Approve – (lag(Approve)));&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC PRINT DATA = clinton_data1;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC CORR DATA = clinton_data1;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;VAR elapsed_time difference_approval;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC CORR DATA = clinton_data1;&lt;BR /&gt;VAR elapsed_time difference_approval;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC CORR DATA = clinton_data1;&lt;BR /&gt;VAR Approve;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;WITH elapsed_time;&lt;BR /&gt;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting below error. Can anyone please help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasSource"&gt;&lt;FONT color="#000000"&gt;72 elapsed_time = (Date – (lag(Date)));&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;FONT color="#FF6600"&gt;___&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;FONT color="#FF6600"&gt;22&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;FONT color="#FF6600"&gt;68&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;FONT color="#000000"&gt;73 difference_approval = (Approve – (lag(Approve)));&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;FONT color="#FF6600"&gt;___&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;FONT color="#FF6600"&gt;22&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;FONT color="#FF6600"&gt;68&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;FONT color="#FF6600"&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, (, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;FONT color="#FF6600"&gt;LE, LT, MAX, MIN, NE, NG, NL, OR, [, ^=, {, |, ||, ~=.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;FONT color="#FF6600"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;FONT color="#FF6600"&gt;ERROR 68-185: The function – is unknown, or cannot be accessed.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;FONT color="#FF6600"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 RUN;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Any ideas please? I think SAS University edition doesn't support LAG function. But I'm not sure.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;If so, any thoughts on why I'm getting this error? any alternative thoughts?&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Thanks a lot in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 19:27:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-Lag-function-works-in-SAS-University-Edition/m-p/307470#M65856</guid>
      <dc:creator>arunvaibhav</dc:creator>
      <dc:date>2016-10-26T19:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Does Lag function works in SAS University Edition???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-Lag-function-works-in-SAS-University-Edition/m-p/307478#M65861</link>
      <description>&lt;P&gt;There is no LAG(&lt;EM&gt;var&lt;/EM&gt;) for the &lt;STRONG&gt;first&lt;/STRONG&gt; observation in the dataset.&lt;/P&gt;
&lt;P&gt;You should code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if _N_ = 1 then do;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;elapsed_time = . ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;difference_approval = . ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;end; else do;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;elapsed_time = Date – lag(Date);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;difference_approval = Approve – lag(Approve);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;end;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 19:59:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-Lag-function-works-in-SAS-University-Edition/m-p/307478#M65861</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-10-26T19:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: Does Lag function works in SAS University Edition???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-Lag-function-works-in-SAS-University-Edition/m-p/307482#M65864</link>
      <description>&lt;P&gt;It looks like the editor you are using gives you a symbol that looks like a minus sign, but is really something else.&amp;nbsp; Just find the right symbol for a minus sign.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 20:19:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-Lag-function-works-in-SAS-University-Edition/m-p/307482#M65864</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-10-26T20:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Does Lag function works in SAS University Edition???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-Lag-function-works-in-SAS-University-Edition/m-p/307489#M65866</link>
      <description>&lt;P&gt;To clarify Astounding's comment: if you cut/paste from Miscrosoft word or even some web pages, you can paste in an en-dash or em-dash, which is an HTML or rich-text character. Delete the "minus sign" and replace it with a regular hyphen character.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 20:52:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-Lag-function-works-in-SAS-University-Edition/m-p/307489#M65866</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-10-26T20:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Does Lag function works in SAS University Edition???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-Lag-function-works-in-SAS-University-Edition/m-p/307490#M65867</link>
      <description>&lt;P&gt;I just deleted the minus symbol and again retyped it and ran, and it worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 20:56:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-Lag-function-works-in-SAS-University-Edition/m-p/307490#M65867</guid>
      <dc:creator>arunvaibhav</dc:creator>
      <dc:date>2016-10-26T20:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Does Lag function works in SAS University Edition???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-Lag-function-works-in-SAS-University-Edition/m-p/307491#M65868</link>
      <description>&lt;P&gt;Thanks Shmuel for responding fast. And nice logic &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; will implement and check this too&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 20:57:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-Lag-function-works-in-SAS-University-Edition/m-p/307491#M65868</guid>
      <dc:creator>arunvaibhav</dc:creator>
      <dc:date>2016-10-26T20:57:34Z</dc:date>
    </item>
  </channel>
</rss>

