<?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: Proc report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/658058#M197210</link>
    <description>&lt;P&gt;It is in the order of the columns specified in the PROC REPORT COLUMNS statement. Since variable IND is specified as an ACROSS variable, and it has three levels, the columns are _C3_ (which corresponds to ID=1 which is "accept") _C4_ (which corresponds to ID=2 which is "reject" _C5_(which corresponds to ID=3 which is "refer") so the levels are in numerical order, which is the default because ID is a numeric variable (if you do this for a character variable, the default ordering is alphabetical order)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note OPENDATE is _C1_ and ID is _C2_ according to the COLUMNS statement.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jun 2020 13:29:20 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-06-12T13:29:20Z</dc:date>
    <item>
      <title>Proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657424#M196991</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;What&amp;nbsp; is the way to create the following summary report using Proc Report?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value FFF
1='ACCEPT'
2='Reject'
3='REFER'
;
run;

Data ttt;
format opendate  date9. Ind FFF.;
input ID Ind opendate :date9.;
cards;
1 1 07JUN2020'd
2 1 07JUN2020'd
3 1 07JUN2020'd
4 2 07JUN2020'd
5 1 07JUN2020'd
6 3 12JUN2020'd
7 3 12JUN2020'd
8 2 12JUN2020'd
9 2 12JUN2020'd
10 2 12JUN2020'd
;
run;
title 'Summary table';
PROC SQL;
	select opendate,
	       count(*) as No_customers,
	       sum(case when put(Ind,FFF.)='ACCEPT' then 1 else 0 end ) as no_customers_DECLINE,
	       sum(case when put(Ind,FFF.)='Reject' then 1 else 0 end ) as no_customers_ACCEPT,
	       sum(case when put(Ind,FFF.)='REFER' then 1 else 0 end ) as no_customers_REFER ,
           calculated  no_customers_DECLINE/calculated No_customers as pct_DECLINE format=percent8.2,
           calculated  no_customers_ACCEPT/calculated No_customers as pct_ACCEPT format=percent8.2,
           calculated  no_customers_REFER/calculated No_customers as pct_REFER format=percent8.2
	from  ttt
	group by opendate
;
QUIT;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jun 2020 10:33:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657424#M196991</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-06-11T10:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657441#M197000</link>
      <description>&lt;P&gt;1. Why proc report for this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Note that&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;sum(case when put(Ind,FFF.)='DECLINE' then 1 else 0 end ) as no_customers_DECLINE,&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can be shortened to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;sum ( put(Ind,FFF.)='DECLINE' ) as no_customers_DECLINE,&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3.&amp;nbsp; For clarity,&amp;nbsp;No_customers&amp;nbsp; should probably be called&amp;nbsp;Nb_customers instead.&lt;/P&gt;
&lt;P&gt;No&amp;nbsp; is normally used for the identifier (number of &lt;STRONG&gt;the customer).&lt;/STRONG&gt; This is called an ordinal number&lt;/P&gt;
&lt;P&gt;Nb&amp;nbsp; is normally used for the count (number of &lt;STRONG&gt;customers&lt;/STRONG&gt;). This is called a cardinal number&lt;/P&gt;
&lt;P&gt;Since both of these are called a&amp;nbsp;&lt;EM&gt;number &lt;/EM&gt;in&amp;nbsp;English,&amp;nbsp;it is easy to confuse them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[Edited for typos. Sorry about that]&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 22:28:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657441#M197000</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-06-11T22:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657446#M197004</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;I agree that better name is Nb_customers (for number of customers).&lt;/P&gt;
&lt;P&gt;I want to learn proc report and my challenge now to know how to do this report via proc report.&lt;/P&gt;
&lt;P&gt;Let's ask on the other way: Why not to learn&amp;nbsp; do it via proc report???&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 11:23:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657446#M197004</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-06-11T11:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657448#M197005</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value FFF
1='ACCEPT'
2='Reject'
3='REFER'
;
run;

Data ttt;
format opendate  date9. Ind FFF.;
input ID Ind opendate :date9.;
cards;
1 1 07JUN2020'd
2 1 07JUN2020'd
3 1 07JUN2020'd
4 2 07JUN2020'd
5 1 07JUN2020'd
6 3 12JUN2020'd
7 3 12JUN2020'd
8 2 12JUN2020'd
9 2 12JUN2020'd
10 2 12JUN2020'd
;
run;
title 'Summary table';
PROC SQL;
	select opendate,
	       count(*) as Nr_customers,
	       sum(case when put(Ind,FFF.)='ACCEPT' then 1 else 0 end ) as Nr_customers_DECLINE,
	       sum(case when put(Ind,FFF.)='Reject' then 1 else 0 end ) as Nr_customers_ACCEPT,
	       sum(case when put(Ind,FFF.)='REFER' then 1 else 0 end ) as Nr_customers_REFER ,
           calculated  Nr_customers_DECLINE/calculated Nr_customers as pct_DECLINE format=percent8.2,
           calculated  Nr_customers_ACCEPT/calculated Nr_customers as pct_ACCEPT format=percent8.2,
           calculated  Nr_customers_REFER/calculated Nr_customers as pct_REFER format=percent8.2
	from  ttt
	group by opendate
;
QUIT;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jun 2020 11:25:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657448#M197005</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-06-11T11:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657449#M197006</link>
      <description>&lt;P&gt;Note that&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;sum(case when put(Ind,FFF.)='ACCEPT' then 1 else 0 end ) as no_customers_DECLINE,&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can be shortened to&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sum(case when ind=1 then 1 else 0 end ) as no_customers_ACCEPT,&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I think you have just computed the number of customers that ACCEPT and not the number of customers that DECLINE, you seem to have ACCEPT and DECLINE reversed. Your formats are not providing value here, anyway.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 11:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657449#M197006</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-06-11T11:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657451#M197007</link>
      <description>&lt;P&gt;First of all I do not see the point of format created if it is not used for anything.&lt;/P&gt;
&lt;P&gt;The case when can be changed to the following&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sum((ind=1*1) ) as Nr_customers_DECLINE,
 sum((ind=2)*1 ) as Nr_customers_ACCEPT,
sum((ind=3)*1 ) as Nr_customers_REFER ,&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;for proc report consider this article&amp;nbsp;&lt;A href="https://support.sas.com/resources/papers/proceedings/proceedings/sugi30/259-30.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings/proceedings/sugi30/259-30.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 11:44:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657451#M197007</guid>
      <dc:creator>smantha</dc:creator>
      <dc:date>2020-06-11T11:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657454#M197008</link>
      <description>&lt;P&gt;Edited my previous reply, sorry for the typo.&lt;/P&gt;
&lt;P&gt;SQL is a clearer and easier to maintain in this case, but to learn, why not other procedures indeed.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 11:46:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657454#M197008</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-06-11T11:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657455#M197009</link>
      <description>&lt;P&gt;This would probably do the trick:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC REPORT DATA=WORK.TTT LS=93  PS=80  SPLIT="/" CENTER nowd;
COLUMNS  opendate ID Ind  pct_acc pct_ref pct_rej;

DEFINE  opendate / GROUP FORMAT= DATE9. WIDTH=9     SPACING=2   RIGHT "opendate" ;
DEFINE  Ind / ACROSS FORMAT= FFF6. WIDTH=6     SPACING=2   RIGHT "Ind" ;
DEFINE  ID / N FORMAT= BEST9. WIDTH=9     SPACING=2   RIGHT "Nr of Customers" ;

DEFINE pct_acc / computed "PCT_Accept" F=PERCENT8.2;
DEFINE pct_ref / computed "PCT_Reference" F=PERCENT8.2;
DEFINE pct_rej / computed "PCT_Rejected" F=PERCENT8.2;

COMPUTE pct_acc ;
 pct_acc=_c3_/ID.n;
ENDCOMP;

COMPUTE pct_ref ;
 pct_ref=_c4_/ID.n;
ENDCOMP;

COMPUTE pct_rej ;
 pct_rej=_c5_/ID.n;
ENDCOMP;


RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jun 2020 11:47:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657455#M197009</guid>
      <dc:creator>MCoopmans</dc:creator>
      <dc:date>2020-06-11T11:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657871#M197158</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;What is the reason that you multiply by 1?&lt;/P&gt;
&lt;P&gt;Why will it no work like that please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sum((ind=1)) as Nr_customers_DECLINE,
sum((ind=2)) as Nr_customers_ACCEPT,
sum((ind=3)) as Nr_customers_REFER ,&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 03:56:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657871#M197158</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-06-12T03:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657872#M197159</link>
      <description>&lt;P&gt;May you show the solution with other procedures please?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 03:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657872#M197159</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-06-12T03:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657879#M197162</link>
      <description>Thank you so much!!!&lt;BR /&gt;May I ask please how do you know that:&lt;BR /&gt;Number of customers accepts is in _C_3&lt;BR /&gt;Number of customers referred  is in _C_4&lt;BR /&gt;Number of customers rejected  is in _C_5&lt;BR /&gt;&lt;BR /&gt;This is a big potential for doing mistake in this step.&lt;BR /&gt;I want to learn your way to find that accept is _c_3  ,refer is _c_4 and reject is _c5_ .&lt;BR /&gt;&lt;BR /&gt;Why the order is like that?&lt;BR /&gt;Is it by alphanumeric order?</description>
      <pubDate>Fri, 12 Jun 2020 04:10:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/657879#M197162</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-06-12T04:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/658058#M197210</link>
      <description>&lt;P&gt;It is in the order of the columns specified in the PROC REPORT COLUMNS statement. Since variable IND is specified as an ACROSS variable, and it has three levels, the columns are _C3_ (which corresponds to ID=1 which is "accept") _C4_ (which corresponds to ID=2 which is "reject" _C5_(which corresponds to ID=3 which is "refer") so the levels are in numerical order, which is the default because ID is a numeric variable (if you do this for a character variable, the default ordering is alphabetical order)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note OPENDATE is _C1_ and ID is _C2_ according to the COLUMNS statement.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 13:29:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/658058#M197210</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-06-12T13:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/658080#M197219</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I don't understand this logic:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1591971017007.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/42845i45D199199617CFFC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1591971017007.png" alt="Cynthia_sas_0-1591971017007.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Is this a typo or is there some other reason that the Accepts are being counted as Declines?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if you want them to appear as percent "decline" why does the format use the word Reject? What is the reason for the ACCEPT and REFER to be uppercase and the Reject&amp;nbsp; to be mixed case?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; PROC REPORT can do this. You'd have to use ACROSS items and getting the order you want might require some fiddling. Not sure about why you want the order you want. If the IND values are 1,2,3 (Accept,Reject,Refer), why display them as Decline, Accept, Refer???&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 14:25:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report/m-p/658080#M197219</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2020-06-12T14:25:35Z</dc:date>
    </item>
  </channel>
</rss>

