<?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: help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/help/m-p/177985#M264869</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data abc1;
input eid name$ age order_nu;
cards;
100 ppp 26 112
100 ppp 26 113
100 ppp 25 116
101 qqq 32 114
102 qqw 31 119
102 qqq 32 120
104 yyy 53 121
102 xxx 51 121
;
 

data abc;
input eid name$ age;
cards;
100 ppp 26
101 qqq 32
102 qqw 31
104 yyy 53
;
run;

proc sql;
 create table want as
 select * from abc 
&amp;nbsp;&amp;nbsp; where eid in (select distinct eid from abc1 group by eid having count(*) ge 2) ;
quit;

/****** OR *******/

proc sql;
 create table want1 as
&amp;nbsp; select * from abc 
&amp;nbsp;&amp;nbsp; where exists(select eid from abc1 where eid=abc.eid group by eid having count(*) ge 2) ;
quit;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 13 Apr 2014 08:57:52 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2014-04-13T08:57:52Z</dc:date>
    <item>
      <title>help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help/m-p/177982#M264866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thanks all in advance for your answers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Question&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;I have 2 tables, a person table containing 1 record per person, and an orders table with many orders per person, with a key on person_id.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;Using proc sql, how would you create a table containing only the id and name of any people that have made two or more orders?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Apr 2014 18:24:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help/m-p/177982#M264866</guid>
      <dc:creator>manjo</dc:creator>
      <dc:date>2014-04-12T18:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help/m-p/177983#M264867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Post your sample data .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Apr 2014 02:38:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help/m-p/177983#M264867</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-04-13T02:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help/m-p/177984#M264868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;*order table;&lt;/P&gt;&lt;P&gt;data abc1;&lt;/P&gt;&lt;P&gt;input eid name$ age order_nu;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;100 ppp 26 112&lt;/P&gt;&lt;P&gt;100 ppp 26 113&lt;/P&gt;&lt;P&gt;100 ppp 25 116&lt;/P&gt;&lt;P&gt;101 qqq 32 114&lt;/P&gt;&lt;P&gt;102 qqw 31 119&lt;/P&gt;&lt;P&gt;102 qqq 32 120&lt;/P&gt;&lt;P&gt;104 yyy 53 121&lt;/P&gt;&lt;P&gt;102 xxx 51 121&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*person table;&lt;/P&gt;&lt;P&gt;data abc;&lt;/P&gt;&lt;P&gt;input eid name$ age;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;100 ppp 26&lt;/P&gt;&lt;P&gt;101 qqq 32&lt;/P&gt;&lt;P&gt;102 qqw 31&lt;/P&gt;&lt;P&gt;104 yyy 53&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Apr 2014 07:47:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help/m-p/177984#M264868</guid>
      <dc:creator>manjo</dc:creator>
      <dc:date>2014-04-13T07:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help/m-p/177985#M264869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data abc1;
input eid name$ age order_nu;
cards;
100 ppp 26 112
100 ppp 26 113
100 ppp 25 116
101 qqq 32 114
102 qqw 31 119
102 qqq 32 120
104 yyy 53 121
102 xxx 51 121
;
 

data abc;
input eid name$ age;
cards;
100 ppp 26
101 qqq 32
102 qqw 31
104 yyy 53
;
run;

proc sql;
 create table want as
 select * from abc 
&amp;nbsp;&amp;nbsp; where eid in (select distinct eid from abc1 group by eid having count(*) ge 2) ;
quit;

/****** OR *******/

proc sql;
 create table want1 as
&amp;nbsp; select * from abc 
&amp;nbsp;&amp;nbsp; where exists(select eid from abc1 where eid=abc.eid group by eid having count(*) ge 2) ;
quit;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Apr 2014 08:57:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help/m-p/177985#M264869</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-04-13T08:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help/m-p/177986#M264870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Ksharp&lt;/P&gt;&lt;P&gt;If in case i want to &lt;SPAN style="color: #500050; font-family: Arial; background-color: #ffffff;"&gt; create a table containing only the id and name of any people and &lt;STRONG&gt;THEIR ORDERS&lt;/STRONG&gt; who have made two or more orders means how can i alter this?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Apr 2014 14:11:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help/m-p/177986#M264870</guid>
      <dc:creator>manjo</dc:creator>
      <dc:date>2014-04-13T14:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help/m-p/177987#M264871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In that case, you can just replace the select * with select eid, name. ' * ' indicates selecting all the variables for display. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Apr 2014 14:20:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help/m-p/177987#M264871</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2014-04-13T14:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help/m-p/177988#M264872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If i run that above codes the output is this&lt;/P&gt;&lt;P&gt;eid&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; age&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; order_nu&lt;/P&gt;&lt;P&gt;100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ppp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 112&lt;/P&gt;&lt;P&gt;102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; qqw&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 31&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 119&lt;/P&gt;&lt;P&gt;but instead of that i need an out put of&lt;/P&gt;&lt;P&gt;eid name age order_nu&lt;/P&gt;&lt;P&gt;100 ppp 26 112&lt;/P&gt;&lt;P&gt;100 ppp 26 113&lt;/P&gt;&lt;P&gt;100 ppp 25 116&lt;/P&gt;&lt;P&gt;102 qqw 31 119&lt;/P&gt;&lt;P&gt;102 qqq 32 120&lt;/P&gt;&lt;P&gt;102 xxx 51 121&lt;/P&gt;&lt;P&gt;like this &lt;/P&gt;&lt;P&gt;all the records expect the person who made order only once&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Apr 2014 15:33:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help/m-p/177988#M264872</guid>
      <dc:creator>manjo</dc:creator>
      <dc:date>2014-04-13T15:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help/m-p/177989#M264873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please try the below code&lt;/P&gt;&lt;P&gt;&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 * from abc1 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where eid in (select distinct eid from abc1 group by eid having count(*) gt 1) ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Apr 2014 16:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help/m-p/177989#M264873</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2014-04-13T16:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help/m-p/177990#M264874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Names are incoherent between tables abc1 and abc for eid=102. Every single piece of information should belong to a single table. Assuming eid is the most valid key, you should do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data orders;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;input eid name$ age order_nu;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;drop age name;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;cards;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;100 ppp 26 112&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;100 ppp 26 113&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;100 ppp 25 116&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;101 qqq 32 114&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;102 qqw 31 119&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;102 qqq 32 120&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;104 yyy 53 121&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;102 xxx 51 121&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data persons;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;input eid name$ age;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;cards;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;100 ppp 26&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;101 qqq 32&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;102 qqw 31&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;104 yyy 53&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;create table multipleOrders as&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select p.eid, p.name, count(o.order_nu) as nbOrders&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;from &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; persons as p inner join&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; orders as o on p.eid=o.eid&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;group by p.eid, p.name&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;having count(order_nu) &amp;gt; 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select * from multipleOrders&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Apr 2014 18:50:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help/m-p/177990#M264874</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-04-13T18:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help/m-p/177991#M264875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Apr 2014 21:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help/m-p/177991#M264875</guid>
      <dc:creator>manjo</dc:creator>
      <dc:date>2014-04-13T21:45:37Z</dc:date>
    </item>
  </channel>
</rss>

