<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/225510#M40491</link>
    <description>&lt;P&gt;Hi Team,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;i need to pull some data from DATABASE for some about 50000 participants.ppts unique number is present in file which is in char format in database.&lt;/P&gt;
&lt;P&gt;code :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data abc;&lt;/P&gt;
&lt;P&gt;infile abcsajk;&lt;/P&gt;
&lt;P&gt;input @001&amp;nbsp; unique $9.&lt;/P&gt;
&lt;P&gt;line = " ' " !! unique !! " ' "&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%let ppts; creating macro vraiable&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;select unique : line&lt;/P&gt;
&lt;P&gt;into ppts&lt;/P&gt;
&lt;P&gt;from abc;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;database connection;&lt;/P&gt;
&lt;P&gt;create table select * from connectio to database(&lt;/P&gt;
&lt;P&gt;select * from db.table where unique_id in (&amp;amp;ppts)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Problem here is when ppts get resolved statement length get increased then it's length and query do not run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So as per me solution could be if i can use sas dataset in subquery like below&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;database connection;&lt;/P&gt;
&lt;P&gt;create table select * from connectio to database(&lt;/P&gt;
&lt;P&gt;select * from db.table where unique_id in (select line from WORK.abc)&lt;/P&gt;
&lt;P&gt;but its not working ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help or tell me its possible or not.whether we can uses sas dataset in subquery&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Sep 2015 04:57:29 GMT</pubDate>
    <dc:creator>ankitpal064</dc:creator>
    <dc:date>2015-09-15T04:57:29Z</dc:date>
    <item>
      <title>Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/225510#M40491</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;i need to pull some data from DATABASE for some about 50000 participants.ppts unique number is present in file which is in char format in database.&lt;/P&gt;
&lt;P&gt;code :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data abc;&lt;/P&gt;
&lt;P&gt;infile abcsajk;&lt;/P&gt;
&lt;P&gt;input @001&amp;nbsp; unique $9.&lt;/P&gt;
&lt;P&gt;line = " ' " !! unique !! " ' "&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%let ppts; creating macro vraiable&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;select unique : line&lt;/P&gt;
&lt;P&gt;into ppts&lt;/P&gt;
&lt;P&gt;from abc;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;database connection;&lt;/P&gt;
&lt;P&gt;create table select * from connectio to database(&lt;/P&gt;
&lt;P&gt;select * from db.table where unique_id in (&amp;amp;ppts)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Problem here is when ppts get resolved statement length get increased then it's length and query do not run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So as per me solution could be if i can use sas dataset in subquery like below&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;database connection;&lt;/P&gt;
&lt;P&gt;create table select * from connectio to database(&lt;/P&gt;
&lt;P&gt;select * from db.table where unique_id in (select line from WORK.abc)&lt;/P&gt;
&lt;P&gt;but its not working ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help or tell me its possible or not.whether we can uses sas dataset in subquery&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 04:57:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/225510#M40491</guid>
      <dc:creator>ankitpal064</dc:creator>
      <dc:date>2015-09-15T04:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/225512#M40493</link>
      <description>&lt;P&gt;Yes it is possible but you need to upload the SAS table into the database first so both tables are in the same environment. The best way is to create a temporary database table containing the SAS data you wish to use for subsetting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What database are you using and does your user name have the database permissions to create a temporary table? You may need to confirm this with a DBA.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 05:30:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/225512#M40493</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-09-15T05:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/225627#M40521</link>
      <description>&lt;P&gt;If I understand your issue is that the variable Line is too long. So specify the maximum length before use:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data abc;
infile abcsajk;
input @001  unique $9. ;
length line $ 15;
line = " ' " !! unique !! " ' ";

run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Also if you do not want spaces in line then consider&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;line = quote(unique);&lt;/P&gt;&lt;P&gt;Did actually want to insert spaces before and after each ' in the value of line? If not either quote as above or use length 11 and "'" instead of the " ' ". The later may be easier to read but is adding characters to the variable.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 15:34:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/225627#M40521</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-09-15T15:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/225699#M40538</link>
      <description>&lt;P&gt;Also I agree that building a WHERE expression in your case is not going to work with 50,000 unique IDs as the size limit for a macro variable is 64K. Uploading a SAS table is the preferrable option.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 20:12:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL/m-p/225699#M40538</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-09-15T20:12:04Z</dc:date>
    </item>
  </channel>
</rss>

