<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592548#M169913</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table want as (
	select datawarehouse.* 
	from datawarehouse 
	   ,(select distinct obs2000 from have)
	where datawarehouse.var1 = have.obs2000
	);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 30 Sep 2019 03:21:21 GMT</pubDate>
    <dc:creator>sustagens</dc:creator>
    <dc:date>2019-09-30T03:21:21Z</dc:date>
    <item>
      <title>proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592162#M169751</link>
      <description>&lt;P&gt;I have a list of 2000 observations. I have to look for other details from a datawarehouse for these 2000 observations. I have tried two methods:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;select a.* /*selecting a total of 20 variables*/&lt;/P&gt;&lt;P&gt;from datawarehouse a&lt;/P&gt;&lt;P&gt;where a.var1 in (select distinct obs2000 from have);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this section is taking forever. I also tried following:&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select distinct obs2000 from have into :obs;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;select a.* /*selecting a total of 20 variables*/&lt;/P&gt;&lt;P&gt;from datawarehouse a&lt;/P&gt;&lt;P&gt;where a.var1 in (&amp;amp;obs.);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this section is giving me an error "length is more than 256 characters long"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is what are other ways to solve a query like these.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2019 14:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592162#M169751</guid>
      <dc:creator>Pooja2</dc:creator>
      <dc:date>2019-09-27T14:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592168#M169753</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/129748"&gt;@Pooja2&lt;/a&gt;&amp;nbsp; Try Hash as an alternative&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
if _n_=1 then do;
   if 0 then set have;/*load distinct values of obs2000 in hash table*/
   dcl hash H (dataset:'have') ;
   h.definekey  ("obs2000") ;
   h.definedata ("obs2000") ;
   h.definedone () ;
end;
set datawarehouse ;
if h.check(key:var1)=0;/*check if exists*/
/*Do whatever logic you want*/
run';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Sep 2019 14:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592168#M169753</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-09-27T14:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592176#M169758</link>
      <description>&lt;P&gt;Apparently your Data warehouse is a relational DB. have you tried the SQL pass Through option ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a001346164.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a001346164.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2019 14:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592176#M169758</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2019-09-27T14:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592177#M169759</link>
      <description>&lt;P&gt;no. I have not. But thanks for the link.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2019 14:32:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592177#M169759</guid>
      <dc:creator>Pooja2</dc:creator>
      <dc:date>2019-09-27T14:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592272#M169800</link>
      <description>&lt;P&gt;You certainly got errors in the log. Assuming obs2000 are strings, the correct syntax is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select distinct quote(trim(obs2000)) into :list separated by "," from have;
quit;

proc sql;
create table want as
select *
from datawarehouse
where var1 in (&amp;amp;list.);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;if obs2000 are numbers, remove the calls to functions quote and trim.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2019 18:24:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592272#M169800</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-09-27T18:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592548#M169913</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table want as (
	select datawarehouse.* 
	from datawarehouse 
	   ,(select distinct obs2000 from have)
	where datawarehouse.var1 = have.obs2000
	);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Sep 2019 03:21:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592548#M169913</guid>
      <dc:creator>sustagens</dc:creator>
      <dc:date>2019-09-30T03:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592671#M169956</link>
      <description>Try to exploit the DBKEY option. It does this string for you OOTB. &lt;BR /&gt;Another option is to upload your small data set to a RDBMS temporary table, and then the join will be performed there.&lt;BR /&gt;Hash is probably not a good option since it will upload the whole RDBMS table from the database, and you only wish a tiny slice of it.</description>
      <pubDate>Mon, 30 Sep 2019 13:53:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql/m-p/592671#M169956</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2019-09-30T13:53:02Z</dc:date>
    </item>
  </channel>
</rss>

