<?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: Long running proc sql query. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Long-running-proc-sql-query/m-p/761933#M30348</link>
    <description>&lt;P&gt;Also, including startdate and enddate in your select clause but not in your group by clause will force remerging on the counts with the original data (you should get a NOTE about that in the log). Is that intended? If not, you should include startdate and enddate in the group by clause. That would speed things up a bit.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Aug 2021 22:28:25 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2021-08-16T22:28:25Z</dc:date>
    <item>
      <title>Long running proc sql query.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Long-running-proc-sql-query/m-p/761886#M30342</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table 	dashare.Total_Click_Impressions_Lead4 as
		select 		
					distinct A.date,
					A.Product,
					count( distinct A.ImpressionId) as Impressions,
					count( distinct B.clickid) as Clicks,
					count(distinct row_id||x_adcb_prod_group||adcb_utm_camp||utm_medium) as Leads,
					startdate as start_date ,enddate as end_date 
		from 
					impressions A
						left join 
					clicks B 
							on 	A.date = B.date and 
								A.Product = B.ProductLabel
						left join 	(
										select 
												 row_id,x_adcb_prod_group,adcb_utm_camp,utm_medium,x_adcb_last_lead_action_date
										from 
													DAshare.HYPERPERSONALIZATION_LEADS
										where 
													x_adcb_last_lead_action_date = '09Aug2021'd
									) C
							on 	A.date = C.x_adcb_last_lead_action_date and
								A.Product = C.adcb_utm_camp
 						left join	(
										select 
 													min(date) format date11. as startdate,
 													max(date) format date11. as enddate,
													product
										from 
													dashare.Total_Click_Impressions_Lead
													group by
													product having max(date) &amp;gt;='09Aug2021'd
									) D 
							on A.Product = D.Product
		group by 	A.date, A.Product;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Aug 2021 18:44:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Long-running-proc-sql-query/m-p/761886#M30342</guid>
      <dc:creator>SASUserRocks</dc:creator>
      <dc:date>2021-08-16T18:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Long running proc sql query.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Long-running-proc-sql-query/m-p/761895#M30346</link>
      <description>&lt;P&gt;Is there a question here?&lt;/P&gt;
&lt;P&gt;Are you looking for ways to speed it up?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might see if it helps to summarize IMPRESSION before joining with the other things:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;from  (date,product, count(distinct impressionid) as impressions from impressions
 group by date,product) A&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Aug 2021 19:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Long-running-proc-sql-query/m-p/761895#M30346</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-16T19:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Long running proc sql query.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Long-running-proc-sql-query/m-p/761929#M30347</link>
      <description>&lt;P&gt;Using DISTINCT all over the place will definitely slow your query. Are they all necessary?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 21:44:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Long-running-proc-sql-query/m-p/761929#M30347</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-08-16T21:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: Long running proc sql query.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Long-running-proc-sql-query/m-p/761933#M30348</link>
      <description>&lt;P&gt;Also, including startdate and enddate in your select clause but not in your group by clause will force remerging on the counts with the original data (you should get a NOTE about that in the log). Is that intended? If not, you should include startdate and enddate in the group by clause. That would speed things up a bit.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 22:28:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Long-running-proc-sql-query/m-p/761933#M30348</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2021-08-16T22:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Long running proc sql query.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Long-running-proc-sql-query/m-p/761984#M30351</link>
      <description>&lt;P&gt;This topic seems to continue &lt;A href="https://communities.sas.com/t5/SAS-Programming/Proc-sql-query-optimization-Running-long-hours/m-p/761800" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Proc-sql-query-optimization-Running-long-hours/m-p/761800&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Posting log with debugging options enabled and sample data could help use finding ways to improve the code.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 07:26:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Long-running-proc-sql-query/m-p/761984#M30351</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-08-17T07:26:17Z</dc:date>
    </item>
  </channel>
</rss>

