<?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: Getting duplication of each records when doing PROC Report in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Getting-duplication-of-each-records-when-doing-PROC-Report/m-p/251476#M56708</link>
    <description>&lt;P&gt;What do you expect ? That is what is supposed to do .&lt;/P&gt;
&lt;P&gt;you define&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;BREAK BEFORE Nationality/ SUMMARIZE;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data shoes;
infile cards truncover;
input
ID : $40. Name &amp;amp; $30. Sex $  Country : $40. Nationality : $40. Ocupation &amp;amp; $40. Age ;
 cards;
990101-14-9900 Yandhi Wong   F Nigeria    Nigerian    Cheerleading   22
881212-10-8811 Nathan Wong   M Honduras     Nigerian    Drug Lord   17
630303-11-6633 Dicky Wong   M China   Indian    Monk    99
660404-14-4444 Grace Wong   F Mongolia    Mongolian    Modeling   44
770707-07-1717 Chin Teck Min   M China    China    Duck Shop   33
920901-09-7777 Wong Hong Qui   M Malaysia    Malaysian    Psychologist   29
880818-10-8888 Teoh Eu Ern   F Malaysia    Malaysian    Kungfu Master   33
A998877 Abdulla Omar   F Iraq    Iraqi    Spy   28
;
run;
proc sort data=shoes;
by nationality;
run;
 
proc report data=shoes nowd;
COL Name Age Country Nationality Age=Agemean;
DEFINE Age /analysis sum 'Age Sum';
DEFINE Country /DISPLAY 'Country of Origin';
DEFINE Agemean/analysis mean 'Age Mean';
DEFINE Name /DISPLAY;
DEFINE Nationality /GROUP;

COMPUTE Country;
IF Country = 'China' THEN
CALL DEFINE (_COL_, "STYLE", "STYLE=[COLOR=CORNFLOWERBLUE]");
ENDCOMP;

COMPUTE Age;
IF Name ='Dicky Wong' THEN CALL DEFINE (_COL_, "STYLE","STYLE=[COLOR=CHARTREUSE]");
ENDCOMP;
BREAK BEFORE Nationality/ SUMMARIZE;

/*BREAK AFTER Nationality / SUMMARIZE;*/

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 22 Feb 2016 05:43:19 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-02-22T05:43:19Z</dc:date>
    <item>
      <title>Getting duplication of each records when doing PROC Report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Getting-duplication-of-each-records-when-doing-PROC-Report/m-p/251453#M56701</link>
      <description>&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff" size="3"&gt;Given this set of data, i tried using PROC Report to print all the data with a SUM of AGE(i did MEAN in the code to test between MEAN and SUM). However, when i perform, all i get is duplication of each set of data as you may see below.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff" size="3"&gt;Need your Kind Advice.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff" size="3"&gt;Below is the duplication of data which i dont want.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff" size="3"&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1987i7D3DAAD3C5A1E1DE/image-size/original?v=mpbl-1&amp;amp;px=-1" alt="PROC REport problemjpg.jpg" title="PROC REport problemjpg.jpg" border="0" /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff" size="3"&gt;input&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;ID $ &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;14&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; Name $ &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;16&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;30&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; Sex $ &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;32&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;33&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; Country $ &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;34&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;45&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; Nationality $ &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;46&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;61&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; Ocupation $ &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;62&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;73&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; Age &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;75&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;&lt;FONT face="Courier New" color="#008080" size="3"&gt;78&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;990101-14-9900 Yandhi Wong F Nigeria Nigerian Cheerleading 22&lt;/P&gt;&lt;P&gt;881212-10-8811 Nathan Wong M Honduras Nigerian Drug Lord 17&lt;/P&gt;&lt;P&gt;630303-11-6633 Dicky Wong M China Indian Monk&lt;/P&gt;&lt;P&gt;99 660404-14-4444 Grace Wong F Mongolia Mongolian Modeling 44&lt;/P&gt;&lt;P&gt;770707-07-1717 Chin Teck Min M China China Duck Shop 33&lt;/P&gt;&lt;P&gt;920901-09-7777 Wong Hong Qui M Malaysia Malaysian Psychologist 29&lt;/P&gt;&lt;P&gt;880818-10-8888 Teoh Eu Ern F Malaysia Malaysian Kungfu Master 33&lt;/P&gt;&lt;P&gt;A998877 Abdulla Omar F Iraq Iraqi Spy 28&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&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=ALFRED.shoes;
by nationality;
run;
 
proc report data=ALFRED.shoes

/*STYLE(HEADER)=[BACKGROUNDCOLOR=ORANGE FONT WEIGHT=BOLD*/

/*STYLE(SUMMARY)=[(COLOR=WHITE BACKGROUNDCOLOR=GREEN FONTFAMILY=ARIAL FONTSIZE=2*/

/*TEXTALIGH=CENTER CELLWIDTH=1in}*/

;

COL Name Age Country Nationality Agemean;

DEFINE Age /analysis mean;

DEFINE Country /DISPLAY 'Country of Origin';

DEFINE Agemean /COMPUTED 'Age Mean';

DEFINE Name /DISPLAY;

DEFINENationality /GROUP;

COMPUTEAgemean;

Agemean=Age.mean;

ENDCOMP;

COMPUTE Country;

IF Country = 'China' THEN

CALL DEFINE (_COL_, "STYLE", "STYLE=[COLOR=CORNFLOWERBLUE]");

ENDCOMP;

COMPUTE Age;

IF Name ='Dicky Wong' THEN CALL DEFINE (_COL_, "STYLE","STYLE=[COLOR=CHARTREUSE]");

ENDCOMP;

BREAK BEFORE Nationality/ SUMMARIZE;

/*BREAK AFTER Nationality / SUMMARIZE;*/

run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;My Result:&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1986i2A33706E11A9E262/image-size/original?v=mpbl-1&amp;amp;px=-1" alt="PROC REport problemjpg.jpg" title="PROC REport problemjpg.jpg" border="0" /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2016 06:48:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Getting-duplication-of-each-records-when-doing-PROC-Report/m-p/251453#M56701</guid>
      <dc:creator>imdickson</dc:creator>
      <dc:date>2016-02-22T06:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: Getting duplication of each records when doing PROC Report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Getting-duplication-of-each-records-when-doing-PROC-Report/m-p/251476#M56708</link>
      <description>&lt;P&gt;What do you expect ? That is what is supposed to do .&lt;/P&gt;
&lt;P&gt;you define&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;BREAK BEFORE Nationality/ SUMMARIZE;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data shoes;
infile cards truncover;
input
ID : $40. Name &amp;amp; $30. Sex $  Country : $40. Nationality : $40. Ocupation &amp;amp; $40. Age ;
 cards;
990101-14-9900 Yandhi Wong   F Nigeria    Nigerian    Cheerleading   22
881212-10-8811 Nathan Wong   M Honduras     Nigerian    Drug Lord   17
630303-11-6633 Dicky Wong   M China   Indian    Monk    99
660404-14-4444 Grace Wong   F Mongolia    Mongolian    Modeling   44
770707-07-1717 Chin Teck Min   M China    China    Duck Shop   33
920901-09-7777 Wong Hong Qui   M Malaysia    Malaysian    Psychologist   29
880818-10-8888 Teoh Eu Ern   F Malaysia    Malaysian    Kungfu Master   33
A998877 Abdulla Omar   F Iraq    Iraqi    Spy   28
;
run;
proc sort data=shoes;
by nationality;
run;
 
proc report data=shoes nowd;
COL Name Age Country Nationality Age=Agemean;
DEFINE Age /analysis sum 'Age Sum';
DEFINE Country /DISPLAY 'Country of Origin';
DEFINE Agemean/analysis mean 'Age Mean';
DEFINE Name /DISPLAY;
DEFINE Nationality /GROUP;

COMPUTE Country;
IF Country = 'China' THEN
CALL DEFINE (_COL_, "STYLE", "STYLE=[COLOR=CORNFLOWERBLUE]");
ENDCOMP;

COMPUTE Age;
IF Name ='Dicky Wong' THEN CALL DEFINE (_COL_, "STYLE","STYLE=[COLOR=CHARTREUSE]");
ENDCOMP;
BREAK BEFORE Nationality/ SUMMARIZE;

/*BREAK AFTER Nationality / SUMMARIZE;*/

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Feb 2016 05:43:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Getting-duplication-of-each-records-when-doing-PROC-Report/m-p/251476#M56708</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-02-22T05:43:19Z</dc:date>
    </item>
  </channel>
</rss>

