<?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: how to control output of Subquery in proc sql; in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-control-output-of-Subquery-in-proc-sql/m-p/20943#M3444</link>
    <description>I may be missing your intent, but the subquery is a fully formed query in its own right.&lt;BR /&gt;
You can add any conditional clauses to it (the subquery) that you like.&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
select * &lt;BR /&gt;
from dim_account&lt;BR /&gt;
where account_id in ( select distinct account_id &lt;BR /&gt;
                                from dim_account&lt;BR /&gt;
                                WHERE somecondition is true)&lt;BR /&gt;
quit;</description>
    <pubDate>Tue, 21 Apr 2009 06:31:01 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-04-21T06:31:01Z</dc:date>
    <item>
      <title>how to control output of Subquery in proc sql;</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-control-output-of-Subquery-in-proc-sql/m-p/20938#M3439</link>
      <description>Hi Reader,&lt;BR /&gt;
&lt;BR /&gt;
I have one query like &lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
     select * &lt;BR /&gt;
     from dim_account&lt;BR /&gt;
     where account_id in (  select distinct account_id &lt;BR /&gt;
                                      from dim_account&lt;BR /&gt;
                                   )&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
i can control the out put of main query in terms of no of observation to be displayed. but now here how can i control the o/p of subquery.&lt;BR /&gt;
in dim_account various account_id are availble and each distinct accout_id have various rows.&lt;BR /&gt;
the output of subquery may be many account_id but i want only first row as output of subquery. so that all rows belongs single account_id will be displayed.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Hint: we use (Firstobs=1 obs=1)  while reading value from data set .</description>
      <pubDate>Sat, 18 Apr 2009 08:13:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-control-output-of-Subquery-in-proc-sql/m-p/20938#M3439</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-18T08:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to control output of Subquery in proc sql;</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-control-output-of-Subquery-in-proc-sql/m-p/20939#M3440</link>
      <description>Hello Arvind,&lt;BR /&gt;
&lt;BR /&gt;
I'm not too sure whether I understood your problem. Are you trying to identify records with no duplicate keys. If so ... this might help. It uses a nice feature of SAS called "query remerging". You can, of course, use this feature in a subquery. &lt;BR /&gt;
&lt;BR /&gt;
data T01_input;&lt;BR /&gt;
do i=1 to 1000;&lt;BR /&gt;
 x=int(ranuni(0)*300);&lt;BR /&gt;
 output;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table T02_output as&lt;BR /&gt;
select *&lt;BR /&gt;
from T01_input&lt;BR /&gt;
group by x&lt;BR /&gt;
having count(*)=1;&lt;BR /&gt;
run;</description>
      <pubDate>Sat, 18 Apr 2009 10:12:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-control-output-of-Subquery-in-proc-sql/m-p/20939#M3440</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-18T10:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to control output of Subquery in proc sql;</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-control-output-of-Subquery-in-proc-sql/m-p/20940#M3441</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
thanks for reply...&lt;BR /&gt;
&lt;BR /&gt;
just the pros sql step which i wrote..in this output of subquery may be more than one row. but i want only specific row .</description>
      <pubDate>Sat, 18 Apr 2009 10:47:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-control-output-of-Subquery-in-proc-sql/m-p/20940#M3441</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-18T10:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to control output of Subquery in proc sql;</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-control-output-of-Subquery-in-proc-sql/m-p/20941#M3442</link>
      <description>i need one specific row's value in IN clause like&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
select * fom dim_account where account_id IN (5000002);&lt;BR /&gt;
quit;</description>
      <pubDate>Sat, 18 Apr 2009 10:49:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-control-output-of-Subquery-in-proc-sql/m-p/20941#M3442</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-18T10:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to control output of Subquery in proc sql;</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-control-output-of-Subquery-in-proc-sql/m-p/20942#M3443</link>
      <description>It's still unclear what you try to achieve, and why.&lt;BR /&gt;
Please apply some more details and background to your problem.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Mon, 20 Apr 2009 07:20:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-control-output-of-Subquery-in-proc-sql/m-p/20942#M3443</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2009-04-20T07:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to control output of Subquery in proc sql;</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-control-output-of-Subquery-in-proc-sql/m-p/20943#M3444</link>
      <description>I may be missing your intent, but the subquery is a fully formed query in its own right.&lt;BR /&gt;
You can add any conditional clauses to it (the subquery) that you like.&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
select * &lt;BR /&gt;
from dim_account&lt;BR /&gt;
where account_id in ( select distinct account_id &lt;BR /&gt;
                                from dim_account&lt;BR /&gt;
                                WHERE somecondition is true)&lt;BR /&gt;
quit;</description>
      <pubDate>Tue, 21 Apr 2009 06:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-control-output-of-Subquery-in-proc-sql/m-p/20943#M3444</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-21T06:31:01Z</dc:date>
    </item>
  </channel>
</rss>

