<?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: problem with calculated variable in proc sql in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/problem-with-calculated-variable-in-proc-sql/m-p/60505#M17141</link>
    <description>where are the SAS-assigned line numbers?  I have to wonder whether you have pasted the "executed" SAS code directly from the log, to go along with the diagnostic messages shared.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Wed, 04 Aug 2010 19:44:33 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-08-04T19:44:33Z</dc:date>
    <item>
      <title>problem with calculated variable in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/problem-with-calculated-variable-in-proc-sql/m-p/60502#M17138</link>
      <description>I have the following codes but coudn't get it to work. Can anyone please help?&lt;BR /&gt;
&lt;BR /&gt;
proc sql ;&lt;BR /&gt;
 create table a as &lt;BR /&gt;
  (select &lt;BR /&gt;
     case&lt;BR /&gt;
        when temp_id in ('01997','01998','01999','02001') then 'P'&lt;BR /&gt;
        else 'N'&lt;BR /&gt;
      end as pa_ind,&lt;BR /&gt;
&lt;BR /&gt;
     sum(amount) as amount_tot&lt;BR /&gt;
&lt;BR /&gt;
   from member a&lt;BR /&gt;
        left outer join group g&lt;BR /&gt;
              on a.member_id=g.member_id&lt;BR /&gt;
&lt;BR /&gt;
   where status_cd = 'Y'&lt;BR /&gt;
&lt;BR /&gt;
   group by calculated pa_ind );&lt;BR /&gt;
quit ;&lt;BR /&gt;
&lt;BR /&gt;
I kept getting an error message like "An unexpected toke "pa_ind" was found following "group by calculated". Expected token may include: "end-of-statement".&lt;BR /&gt;
&lt;BR /&gt;
Can anybody help? Thanks</description>
      <pubDate>Wed, 04 Aug 2010 18:07:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/problem-with-calculated-variable-in-proc-sql/m-p/60502#M17138</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-08-04T18:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: problem with calculated variable in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/problem-with-calculated-variable-in-proc-sql/m-p/60503#M17139</link>
      <description>For the most useful feedback from the forum, suggest you share the exact SAS-generated log (with the embedded SAS diagnostic messages) rather than your "pasted" code-snippet.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 04 Aug 2010 18:17:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/problem-with-calculated-variable-in-proc-sql/m-p/60503#M17139</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-08-04T18:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: problem with calculated variable in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/problem-with-calculated-variable-in-proc-sql/m-p/60504#M17140</link>
      <description>log file******************************************&lt;BR /&gt;
&lt;BR /&gt;
proc sql ;&lt;BR /&gt;
create table a as &lt;BR /&gt;
(select &lt;BR /&gt;
case&lt;BR /&gt;
when temp_id in ('01997','01998','01999','02001') then 'P'&lt;BR /&gt;
else 'N'&lt;BR /&gt;
end as pa_ind,&lt;BR /&gt;
&lt;BR /&gt;
sum(amount) as amount_tot&lt;BR /&gt;
&lt;BR /&gt;
from member a&lt;BR /&gt;
left outer join group g&lt;BR /&gt;
on a.member_id=g.member_id&lt;BR /&gt;
&lt;BR /&gt;
where status_cd = 'Y'&lt;BR /&gt;
&lt;BR /&gt;
group by calculated pa_ind );&lt;BR /&gt;
quit ;&lt;BR /&gt;
&lt;BR /&gt;
ERROR: CLI describe error: [IBM][CLI Driver][DB2/AIX64] SQL0104N  An unexpected token "pa_ind" was found following "group by&lt;BR /&gt;
       calculated".  Expected tokens may include:  "END-OF-STATEMENT".  SQLSTATE=42601&lt;BR /&gt;
&lt;BR /&gt;
[IBM][CLI Driver][DB2/AIX64] SQL0104N  An unexpected token "pa_ind" was found following "group by calculated".  Expected tokens&lt;BR /&gt;
may include:  "END-OF-STATEMENT".  SQLSTATE=42601&lt;BR /&gt;
&lt;BR /&gt;
quit;&lt;BR /&gt;
NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;
NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;
      real time           44.57 seconds&lt;BR /&gt;
      user cpu time       0.04 seconds&lt;BR /&gt;
      system cpu time     0.02 seconds&lt;BR /&gt;
      Memory                            406k&lt;BR /&gt;
      OS Memory                         6948k&lt;BR /&gt;
      Timestamp            8/04/2010  3:18:26 PM&lt;BR /&gt;
      Page Faults                       0</description>
      <pubDate>Wed, 04 Aug 2010 19:39:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/problem-with-calculated-variable-in-proc-sql/m-p/60504#M17140</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-08-04T19:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: problem with calculated variable in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/problem-with-calculated-variable-in-proc-sql/m-p/60505#M17141</link>
      <description>where are the SAS-assigned line numbers?  I have to wonder whether you have pasted the "executed" SAS code directly from the log, to go along with the diagnostic messages shared.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 04 Aug 2010 19:44:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/problem-with-calculated-variable-in-proc-sql/m-p/60505#M17141</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-08-04T19:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: problem with calculated variable in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/problem-with-calculated-variable-in-proc-sql/m-p/60506#M17142</link>
      <description>I agree with Scott. The log indicates you are running a query in a DB2 AIX database but your log does not show how you are connecting to that database. If you are using passthru SQL then I would expect a CONNECT statement. If you are using SAS SQL then I would expect a LIBNAME and LIBREFs referencing the database. Please clarify.</description>
      <pubDate>Wed, 04 Aug 2010 22:00:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/problem-with-calculated-variable-in-proc-sql/m-p/60506#M17142</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2010-08-04T22:00:22Z</dc:date>
    </item>
  </channel>
</rss>

