<?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: Keep and printout DUPLICATE rows in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345446#M79474</link>
    <description>&lt;P&gt;Are you saying there might be no duplicates, but SQL still prints a report?&amp;nbsp; To handle that, you might as well keep your original program, and then add:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=dup;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When there are no observations to print, PROC PRINT sends a message to the log but sends nothing to the output.&amp;nbsp; If&amp;nbsp;you take that approach, you might switch to&amp;nbsp;creating a view instead of a table:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;create view dup as ..........&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if the number of duplicates is going to be small, that wouldn't be necessary.&lt;/P&gt;</description>
    <pubDate>Wed, 29 Mar 2017 16:31:35 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-03-29T16:31:35Z</dc:date>
    <item>
      <title>Keep and printout DUPLICATE rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345423#M79466</link>
      <description>&lt;P&gt;Hi, I am using SAS 9.3.&lt;/P&gt;&lt;P&gt;I would like to keep duplicate rows only and just print them out, but not saving to another dataset.&lt;/P&gt;&lt;P&gt;Now, I get the code which is creating a new dataset to save duplicate rows below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table dup as 
select * 
from have
group by Birth, Sex, Height, Weight
having count(*) &amp;gt; 1; 
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But actually, I just want to print it out. Does anyone have the suggestions?&lt;/P&gt;&lt;P&gt;Perhaps, &lt;STRONG&gt;if&lt;/STRONG&gt; duplicate rows &lt;STRONG&gt;then print&lt;/STRONG&gt;&amp;nbsp;it out. Maybe.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, and appreciate!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;JC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 15:41:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345423#M79466</guid>
      <dc:creator>JohnChen_TW</dc:creator>
      <dc:date>2017-03-29T15:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: Keep and printout DUPLICATE rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345427#M79468</link>
      <description>&lt;P&gt;I'm 99% certain on this ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's creating a table because you asked SQL to create a table.&amp;nbsp; To create a report instead, just remove one line from the program:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;create table dup as&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 15:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345427#M79468</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-29T15:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Keep and printout DUPLICATE rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345443#M79473</link>
      <description>Yes, it works after I removed "create table dup as" but it will print the null result out, too.&lt;BR /&gt;&lt;BR /&gt;Is there a suitable method to detect the table created by SQL is not null?&lt;BR /&gt;&lt;BR /&gt;JC</description>
      <pubDate>Wed, 29 Mar 2017 16:21:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345443#M79473</guid>
      <dc:creator>JohnChen_TW</dc:creator>
      <dc:date>2017-03-29T16:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Keep and printout DUPLICATE rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345446#M79474</link>
      <description>&lt;P&gt;Are you saying there might be no duplicates, but SQL still prints a report?&amp;nbsp; To handle that, you might as well keep your original program, and then add:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=dup;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When there are no observations to print, PROC PRINT sends a message to the log but sends nothing to the output.&amp;nbsp; If&amp;nbsp;you take that approach, you might switch to&amp;nbsp;creating a view instead of a table:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;create view dup as ..........&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if the number of duplicates is going to be small, that wouldn't be necessary.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 16:31:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345446#M79474</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-29T16:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: Keep and printout DUPLICATE rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345454#M79475</link>
      <description>Yes, you are right! It works when I added proc print.&lt;BR /&gt;&lt;BR /&gt;May I ask another question?&lt;BR /&gt;Is it possible to use "call symput" when creating the table with duplicate rows in SQL?</description>
      <pubDate>Wed, 29 Mar 2017 16:53:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345454#M79475</guid>
      <dc:creator>JohnChen_TW</dc:creator>
      <dc:date>2017-03-29T16:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Keep and printout DUPLICATE rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345460#M79477</link>
      <description>&lt;P&gt;No, CALL SYMPUT can only be part of a DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SQL does have ways to create macro variables, using INTO :&amp;nbsp; but it can't use CALL SYMPUT.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 17:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345460#M79477</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-29T17:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Keep and printout DUPLICATE rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345461#M79478</link>
      <description>Okay, thanks for all your support!!!&lt;BR /&gt;It's really helpful for me!&lt;BR /&gt;&lt;BR /&gt;JC</description>
      <pubDate>Wed, 29 Mar 2017 17:03:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-and-printout-DUPLICATE-rows/m-p/345461#M79478</guid>
      <dc:creator>JohnChen_TW</dc:creator>
      <dc:date>2017-03-29T17:03:19Z</dc:date>
    </item>
  </channel>
</rss>

