<?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: proc sql: can I &amp;quot;group by&amp;quot; a variable created in select procedure? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-can-I-quot-group-by-quot-a-variable-created-in-select/m-p/532829#M73796</link>
    <description>Please post sample of your input and its output to demonstrate where it should differ</description>
    <pubDate>Tue, 05 Feb 2019 03:06:10 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2019-02-05T03:06:10Z</dc:date>
    <item>
      <title>proc sql: can I "group by" a variable created in select procedure?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-can-I-quot-group-by-quot-a-variable-created-in-select/m-p/532821#M73792</link>
      <description>&lt;P&gt;Is the following procedure legitimate? Please note that variable month is generated by the procedure itself. I can run it without any error reported, but not sure if the results are perfectly what I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table want as 
	select name, intnx("month", date, 0, 'e') as month format yymmdd10.,  mean(var) as var_ave
	from have
	group by name, month 
	order by name, month;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 01:39:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-can-I-quot-group-by-quot-a-variable-created-in-select/m-p/532821#M73792</guid>
      <dc:creator>xyxu</dc:creator>
      <dc:date>2019-02-05T01:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql: can I "group by" a variable created in select procedure?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-can-I-quot-group-by-quot-a-variable-created-in-select/m-p/532826#M73793</link>
      <description>&lt;P&gt;You need use the descriptive word "calculated", Try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table want as 
	select name, intnx("month", date, 0, 'e') as month format yymmdd10.,  mean(var) as var_ave
	from have
	group by name, calculated month 
	order by name, calculated  month;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Feb 2019 02:36:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-can-I-quot-group-by-quot-a-variable-created-in-select/m-p/532826#M73793</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-02-05T02:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql: can I "group by" a variable created in select procedure?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-can-I-quot-group-by-quot-a-variable-created-in-select/m-p/532827#M73794</link>
      <description>It seems that the results do not change after adding it?</description>
      <pubDate>Tue, 05 Feb 2019 02:42:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-can-I-quot-group-by-quot-a-variable-created-in-select/m-p/532827#M73794</guid>
      <dc:creator>xyxu</dc:creator>
      <dc:date>2019-02-05T02:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql: can I "group by" a variable created in select procedure?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-can-I-quot-group-by-quot-a-variable-created-in-select/m-p/532829#M73796</link>
      <description>Please post sample of your input and its output to demonstrate where it should differ</description>
      <pubDate>Tue, 05 Feb 2019 03:06:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-can-I-quot-group-by-quot-a-variable-created-in-select/m-p/532829#M73796</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-02-05T03:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql: can I "group by" a variable created in select procedure?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-can-I-quot-group-by-quot-a-variable-created-in-select/m-p/532834#M73798</link>
      <description>&lt;P&gt;I suspect use of the keyword - calculated - is optional in your example as both versions work without error.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 03:49:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-can-I-quot-group-by-quot-a-variable-created-in-select/m-p/532834#M73798</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-02-05T03:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql: can I "group by" a variable created in select procedure?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-can-I-quot-group-by-quot-a-variable-created-in-select/m-p/532880#M73800</link>
      <description>&lt;P&gt;Since variable MONTH doesn't exist anywhere else, the keyword &lt;EM&gt;calculated&lt;/EM&gt; can be omitted: it is obvious which MONTH you are referring to. Both queries yield the same result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This &lt;EM&gt;calculated&lt;/EM&gt; keyword is a powerful addition to ANSI SQL made by SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now if only SAS added other&amp;nbsp;&amp;nbsp; &lt;A href="https://communities.sas.com/t5/SASware-Ballot-Ideas/Add-window-functions-in-SAS-SQL/idi-p/462556" target="_self"&gt;useful&lt;/A&gt; &amp;nbsp; &amp;nbsp; &lt;A href="https://communities.sas.com/t5/SASware-Ballot-Ideas/Enhance-the-quot-group-by-quot-evaluation-logic-of-the-SQL/idi-p/491111" target="_self"&gt;language&lt;/A&gt; &amp;nbsp;&amp;nbsp; &lt;A href="https://communities.sas.com/t5/SASware-Ballot-Ideas/create-string-summary-functions/idi-p/288035" target="_self"&gt;extensions&lt;/A&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to SQL...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 10:38:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-can-I-quot-group-by-quot-a-variable-created-in-select/m-p/532880#M73800</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-02-05T10:38:00Z</dc:date>
    </item>
  </channel>
</rss>

