<?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: Output duplicate comments into different excel sheet in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839534#M331942</link>
    <description>Great! Thanks, it worked.</description>
    <pubDate>Wed, 19 Oct 2022 21:51:02 GMT</pubDate>
    <dc:creator>CathyVI</dc:creator>
    <dc:date>2022-10-19T21:51:02Z</dc:date>
    <item>
      <title>Output duplicate comments into different excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839276#M331850</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a dataset with comments similar to the dataset below. I would like to output each comments and its duplicates into different sheet in excel. How do I find the duplicate, after sorting without deleting duplicate and outputting them to each excel sheet?&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data have;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;length comment $ 1000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;input comment$ 1 - 1000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;datalines;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Since it is impossible to completely and completely quit using dependent drugs, it is better to face drug abuse with a positive, rational and practical attitude and point of view&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Substance abuse refers to the intermittent or persistent excessive use of psychoactive substances that is contrary to social norms or is irrelevant or inconsistent with accepted medical practice.Such abuse is far from tentative use, social entertainment or situational need, but gradually turns into a state of intensive use, which leads to the formation of dependence.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Substance abuse refers to the intermittent or persistent excessive use of psychoactive substances that is contrary to social norms or is irrelevant or inconsistent with accepted medical practice.Such abuse is far from tentative use, social entertainment or situational need, but gradually turns into a state of intensive use, which leads to the formation of dependence.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Need safe spaces and safe disposable sites&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Need safe spaces and safe disposable sites&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;More attention has been paid to the concept of harm reduction.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NO&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;No opinion&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Marijuana should be legal.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Need safe spaces and safe disposable sites&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The use of drugs should be vigorously suppressed&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The use of drugs should be vigorously suppressed&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Very bad behavior&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Need safe spaces and safe disposable sites&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Increase control&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I just hope there will be when I need it&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I just hope there will be when I need it&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Increase control&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;No opinion&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Expected results:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sheet 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Need safe spaces and safe disposable sites&lt;BR /&gt;Need safe spaces and safe disposable sites&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Need safe spaces and safe disposable sites&lt;BR /&gt;Need safe spaces and safe disposable sites&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Sheet 2:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;nothing&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;sheet 3:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I just hope there will be when I need it&lt;BR /&gt;I just hope there will be when I need it&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;sheet 4:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Substance abuse refers to the intermittent or persistent excessive use of psychoactive substances that is contrary to social norms or is irrelevant or inconsistent with accepted medical practice.Such abuse is far from tentative use, social entertainment or situational need, but gradually turns into a state of intensive use, which leads to the formation of dependence.&lt;BR /&gt;Substance abuse refers to the intermittent or persistent excessive use of psychoactive substances that is contrary to social norms or is irrelevant or inconsistent with accepted medical practice.Such abuse is far from tentative use, social entertainment or situational need, but gradually turns into a state of intensive use, which leads to the formation of dependence.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and so on.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 19:38:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839276#M331850</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2022-10-18T19:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Output duplicate comments into different excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839282#M331852</link>
      <description>&lt;P&gt;Does that data read in correctly for you? It doesn't for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If order of the results matter you need to add a variable to control the order or you may have one in your data set already so leaving that as an exercise for you to solve.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have other destinations open you may want to close them as otherwise you'll get a lot of printed output.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sort data=have out=duplicates nouniquekey;
by comment;
run;

ods excel file='/home/fkhurshed/Demo1/duplicates.xlsx' options(sheet_interval="bygroup" sheet_label = '' sheet_name = "Duplicate");

options nobyline;
proc print data=duplicates;
by comment;
var comment;
run;

ods excel close;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Oct 2022 20:09:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839282#M331852</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-10-18T20:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: Output duplicate comments into different excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839518#M331934</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code works but I wanted to see all other variables so excluded the "var" statement so that sas can include all variables in the dataset. However, sas included all the variable except "comment". Why is that? Is it because am using "by comment"?&amp;nbsp; How could I have comment and all other variables in the dataset. I don't want to use keep statement because I have a lot of variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 21:08:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839518#M331934</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2022-10-19T21:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Output duplicate comments into different excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839519#M331935</link>
      <description>&lt;P&gt;VAR statement controls what is displayed. Remove the VAR statement and I think it prints all variables by default.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 21:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839519#M331935</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-10-19T21:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Output duplicate comments into different excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839523#M331936</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;Yes i removed the var and all variables was displayed except comment. I want variable "comment" to be displayed too. How will I get it ?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 21:18:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839523#M331936</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2022-10-19T21:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: Output duplicate comments into different excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839531#M331940</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var _all_; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Select all variables for printing then.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 21:34:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839531#M331940</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-10-19T21:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Output duplicate comments into different excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839534#M331942</link>
      <description>Great! Thanks, it worked.</description>
      <pubDate>Wed, 19 Oct 2022 21:51:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-duplicate-comments-into-different-excel-sheet/m-p/839534#M331942</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2022-10-19T21:51:02Z</dc:date>
    </item>
  </channel>
</rss>

