<?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: using Proc Sql to calculate multiple summary based on different conditions in one step in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/using-Proc-Sql-to-calculate-multiple-summary-based-on-different/m-p/666333#M22979</link>
    <description>&lt;P&gt;sorry the update column was a mistake only up_date column in dataset&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jul 2020 11:11:44 GMT</pubDate>
    <dc:creator>fdb00004</dc:creator>
    <dc:date>2020-07-01T11:11:44Z</dc:date>
    <item>
      <title>using Proc Sql to calculate multiple summary based on different conditions in one step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Proc-Sql-to-calculate-multiple-summary-based-on-different/m-p/666324#M22976</link>
      <description>&lt;P&gt;My intention here is to calculate two averages.&lt;/P&gt;&lt;P&gt;1. Before a certain dates and another&lt;/P&gt;&lt;P&gt;2. After certain dates.&lt;/P&gt;&lt;P&gt;Using proc SQL in SAS. I have done this seperately and then merge. How can i simplify the code with just one Proc Sql step.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc SQL;

create table AvgWindPressure as 

select distinct MinPressure, avg(MaxwindMPH) as avgWind_before from work.Storm

where up_date &amp;lt; end_date

group by MinPressure, enddate;

quit;

proc SQL;

create table AvgWindpressure2 as 

select distinct MinPressure, avg(MaxwindMPH) as avg_after
from MaxwindMPH
where up_date &amp;gt; enddate

group by MinPressure, enddate;

quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 11:28:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Proc-Sql-to-calculate-multiple-summary-based-on-different/m-p/666324#M22976</guid>
      <dc:creator>fdb00004</dc:creator>
      <dc:date>2020-07-01T11:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: using Proc Sql to calculate multiple summary based on different conditions in one step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Proc-Sql-to-calculate-multiple-summary-based-on-different/m-p/666327#M22977</link>
      <description>&lt;P&gt;Do you really have a column update and a column up_date in your dataset?&lt;/P&gt;
&lt;P&gt;To get good help fast, it is imperative to present your source data in a usable way (data step with datalines).&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 11:01:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Proc-Sql-to-calculate-multiple-summary-based-on-different/m-p/666327#M22977</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-01T11:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: using Proc Sql to calculate multiple summary based on different conditions in one step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Proc-Sql-to-calculate-multiple-summary-based-on-different/m-p/666329#M22978</link>
      <description>&lt;P&gt;Here's an example using data set SASHELP.CLASS&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 distinct sex,
		mean(case when age&amp;lt;14 then height else . end) as mean_before,
		mean(case when age&amp;gt;=14 then height else . end) as mean_after
		from sashelp.class
		group by sex;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It's also quite easy to do using PROC SUMMARY.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 11:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Proc-Sql-to-calculate-multiple-summary-based-on-different/m-p/666329#M22978</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-01T11:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: using Proc Sql to calculate multiple summary based on different conditions in one step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Proc-Sql-to-calculate-multiple-summary-based-on-different/m-p/666333#M22979</link>
      <description>&lt;P&gt;sorry the update column was a mistake only up_date column in dataset&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 11:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Proc-Sql-to-calculate-multiple-summary-based-on-different/m-p/666333#M22979</guid>
      <dc:creator>fdb00004</dc:creator>
      <dc:date>2020-07-01T11:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: using Proc Sql to calculate multiple summary based on different conditions in one step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-Proc-Sql-to-calculate-multiple-summary-based-on-different/m-p/666334#M22980</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table AvgWindPressure as
  select
    MinPressure,
    avg(case when up_date &amp;lt; end_date then MaxwindMPH else . end) as avgWind_before,
    avg(case when up_date &amp;gt;= end_date then MaxwindMPH else . end) as avgWind_after
  from work.Storm
  group by MinPressure
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;No DISTINCT clause is needed, GROUP BY will take care of that.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 11:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-Proc-Sql-to-calculate-multiple-summary-based-on-different/m-p/666334#M22980</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-01T11:21:12Z</dc:date>
    </item>
  </channel>
</rss>

