<?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: Creating a new variable with the Query Builder in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-new-variable-with-the-Query-Builder/m-p/3191#M1016</link>
    <description>Hi:&lt;BR /&gt;
  You cannot use the LAG function with PROC SQL: &lt;A href="http://support.sas.com/techsup/unotes/SN/014/014659.html" target="_blank"&gt;http://support.sas.com/techsup/unotes/SN/014/014659.html&lt;/A&gt;&lt;BR /&gt;
  Since the EG query builder is building SQL, that is probably the source of the error message you are getting.&lt;BR /&gt;
 &lt;BR /&gt;
  But, you can open a code node and use your DATA step code with the LAG function, per these examples:&lt;BR /&gt;
&lt;A href="http://support.sas.com/ctx/samples/index.jsp?sid=1498&amp;amp;tab=code" target="_blank"&gt;http://support.sas.com/ctx/samples/index.jsp?sid=1498&amp;amp;tab=code&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/ctx/samples/index.jsp?sid=108&amp;amp;tab=code" target="_blank"&gt;http://support.sas.com/ctx/samples/index.jsp?sid=108&amp;amp;tab=code&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
    <pubDate>Wed, 23 May 2007 19:12:44 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2007-05-23T19:12:44Z</dc:date>
    <item>
      <title>Creating a new variable with the Query Builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-new-variable-with-the-Query-Builder/m-p/3190#M1015</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to create a lagged variable (the difference between two rows) with the query builder... with no success. In SAS, I would use the lag or dif functions, but with EG I get an error message.&lt;BR /&gt;
&lt;BR /&gt;
Is there a function that would do this in EG? How would you define this variable?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
D.</description>
      <pubDate>Wed, 23 May 2007 19:00:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-new-variable-with-the-Query-Builder/m-p/3190#M1015</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-05-23T19:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable with the Query Builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-new-variable-with-the-Query-Builder/m-p/3191#M1016</link>
      <description>Hi:&lt;BR /&gt;
  You cannot use the LAG function with PROC SQL: &lt;A href="http://support.sas.com/techsup/unotes/SN/014/014659.html" target="_blank"&gt;http://support.sas.com/techsup/unotes/SN/014/014659.html&lt;/A&gt;&lt;BR /&gt;
  Since the EG query builder is building SQL, that is probably the source of the error message you are getting.&lt;BR /&gt;
 &lt;BR /&gt;
  But, you can open a code node and use your DATA step code with the LAG function, per these examples:&lt;BR /&gt;
&lt;A href="http://support.sas.com/ctx/samples/index.jsp?sid=1498&amp;amp;tab=code" target="_blank"&gt;http://support.sas.com/ctx/samples/index.jsp?sid=1498&amp;amp;tab=code&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/ctx/samples/index.jsp?sid=108&amp;amp;tab=code" target="_blank"&gt;http://support.sas.com/ctx/samples/index.jsp?sid=108&amp;amp;tab=code&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 23 May 2007 19:12:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-new-variable-with-the-Query-Builder/m-p/3191#M1016</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-05-23T19:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable with the Query Builder</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-new-variable-with-the-Query-Builder/m-p/3192#M1017</link>
      <description>Thank you,&lt;BR /&gt;
&lt;BR /&gt;
It did solve my small problem,&lt;BR /&gt;
&lt;BR /&gt;
D.</description>
      <pubDate>Wed, 23 May 2007 20:08:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-new-variable-with-the-Query-Builder/m-p/3192#M1017</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-05-23T20:08:32Z</dc:date>
    </item>
  </channel>
</rss>

