<?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 Proc Sql and year function in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-and-year-function/m-p/65397#M18650</link>
    <description>I am an sql user trying to learn SAS and would appreciate it if anyone would help me with this query.&lt;BR /&gt;
&lt;BR /&gt;
The following code I expected only to bring back the unique dates and there counts.... but running this in SAS returned a record for every observation with the year and count.&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
	select year(change_date),count(*)&lt;BR /&gt;
	from customer_table&lt;BR /&gt;
	group by year(change_date);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
Example result:&lt;BR /&gt;
&lt;BR /&gt;
Year   Count &lt;BR /&gt;
2009   10000&lt;BR /&gt;
2009   10000&lt;BR /&gt;
2009   10000&lt;BR /&gt;
2009   10000&lt;BR /&gt;
...&lt;BR /&gt;
...&lt;BR /&gt;
&lt;BR /&gt;
What would be the correct way to write this query?&lt;BR /&gt;
Cheers.</description>
    <pubDate>Wed, 19 Aug 2009 01:33:02 GMT</pubDate>
    <dc:creator>Hammis</dc:creator>
    <dc:date>2009-08-19T01:33:02Z</dc:date>
    <item>
      <title>Proc Sql and year function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-and-year-function/m-p/65397#M18650</link>
      <description>I am an sql user trying to learn SAS and would appreciate it if anyone would help me with this query.&lt;BR /&gt;
&lt;BR /&gt;
The following code I expected only to bring back the unique dates and there counts.... but running this in SAS returned a record for every observation with the year and count.&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
	select year(change_date),count(*)&lt;BR /&gt;
	from customer_table&lt;BR /&gt;
	group by year(change_date);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
Example result:&lt;BR /&gt;
&lt;BR /&gt;
Year   Count &lt;BR /&gt;
2009   10000&lt;BR /&gt;
2009   10000&lt;BR /&gt;
2009   10000&lt;BR /&gt;
2009   10000&lt;BR /&gt;
...&lt;BR /&gt;
...&lt;BR /&gt;
&lt;BR /&gt;
What would be the correct way to write this query?&lt;BR /&gt;
Cheers.</description>
      <pubDate>Wed, 19 Aug 2009 01:33:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-and-year-function/m-p/65397#M18650</guid>
      <dc:creator>Hammis</dc:creator>
      <dc:date>2009-08-19T01:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql and year function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-and-year-function/m-p/65398#M18651</link>
      <description>You are grouping by a fct of change_date, but change_date in not in your putput.&lt;BR /&gt;
&lt;BR /&gt;
  select year(change_date) as year, count(*)&lt;BR /&gt;
  from customer_table&lt;BR /&gt;
  group by year;&lt;BR /&gt;
&lt;BR /&gt;
will work.</description>
      <pubDate>Wed, 19 Aug 2009 03:24:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-and-year-function/m-p/65398#M18651</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-08-19T03:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql and year function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-and-year-function/m-p/65399#M18652</link>
      <description>You mention "only want to bring back the date", yet you have the YEAR function coded?  Interesting.&lt;BR /&gt;
&lt;BR /&gt;
You will also want to review PROC SQL procedure discussion in the SAS documentation, available at the SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website, along with other topic-related technical papers and conference presentations on relevant topics.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a002473669.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a002473669.htm&lt;/A&gt;</description>
      <pubDate>Wed, 19 Aug 2009 13:16:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Sql-and-year-function/m-p/65399#M18652</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-08-19T13:16:17Z</dc:date>
    </item>
  </channel>
</rss>

