<?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: MTD % in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887887#M350788</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/301412"&gt;@vnreddy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;apart from tabular is there any other way of getting it in list table.&lt;/P&gt;
&lt;P&gt;I need to join this table to an another table.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, TABULATE has an out= option that will write an output dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=test order=data missing out=want;
  class Year Month Org Status ;
  tables Year*Month*Org*Status,pctn&amp;lt;Status&amp;gt;='Per_comp' ;
run ;

proc print data=want ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Aug 2023 14:33:10 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2023-08-04T14:33:10Z</dc:date>
    <item>
      <title>MTD %</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887852#M350767</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Could someone help me with MTD % how can I get this based on organisation A, B, C wise and status C for complete and P for pending.&lt;/P&gt;
&lt;PRE&gt;data test;
input Date :Date9. Year Month $ Org $ Status $;
format Date date9.;
datalines;
07Dec2022 2022 Dec A C
14Jan2023 2023 Jan A C
02Feb2023 2023 Feb A C
02Feb2023 2023 Feb A P
03Feb2023 2023 Feb B C
21Feb2023 2023 Feb C C
24Feb2023 2023 Feb C C
27Feb2023 2023 Feb C P
;
run;
&lt;/PRE&gt;
&lt;P&gt;Expected output: From above data org A in Feb is having 1 complete and 1 pending&amp;nbsp;so my % completion should be&amp;nbsp;50% each, similarly&amp;nbsp;org C in Feb total 3 out of which 2 is completed and 1 is pending.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vnreddy_0-1691153266922.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86440iA210CCFD5CA52A26/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vnreddy_0-1691153266922.png" alt="vnreddy_0-1691153266922.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Vennapusa&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 12:47:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887852#M350767</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2023-08-04T12:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: MTD %</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887856#M350769</link>
      <description>&lt;P&gt;I am not sure what MTD % is. I also request you explain how the column PER_COMP is computed from the original data, as I'm not sure I understand what you want.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 12:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887856#M350769</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-08-04T12:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: MTD %</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887857#M350770</link>
      <description>&lt;P&gt;Can you show the code you have tried?&amp;nbsp; It looks like you could get the answer with PROC FREQ, or maybe a prettier table with PROC TABULATE.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 13:00:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887857#M350770</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-08-04T13:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: MTD %</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887858#M350771</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to calculate the % of C &amp;amp; P on a monthly basis.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 13:01:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887858#M350771</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2023-08-04T13:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: MTD %</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887860#M350773</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/301412"&gt;@vnreddy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to calculate the % of C &amp;amp; P on a monthly basis.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please avoid speaking in abbreviations, as I also don't understand C&amp;amp;P in this context. Please provide actual information that I requested, specifically "&lt;SPAN&gt;I also request you explain how the column PER_COMP is computed from the original data". Please don't ignore this request.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 13:04:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887860#M350773</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-08-04T13:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: MTD %</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887862#M350775</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;Status column C stands for Complete and P for Pending.&lt;/P&gt;
&lt;P&gt;I am trying the Per_comp which is the % breakdown based on Complete and Pending status by Org and Month basis.&amp;nbsp; As you can see e.g., Org C in the month of Feb has 3 total rows out of which 2 is with (complete) C status and 1 is (Pending) P status. Number of (complete) C status/total rows in Feb based on Org C,&amp;nbsp;Number of (pending) P status/total rows in Feb based on Org C which is&amp;nbsp; 66.37% &amp;amp; 33.33%&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 13:20:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887862#M350775</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2023-08-04T13:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: MTD %</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887865#M350776</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input Date :Date9. Year Month $ Org $ Status $;
format Date date9.;
yymm = input(cats(month,year),monyy7.);
format yymm yymmn6.;
datalines;
07Dec2022 2022 Dec A C
14Jan2023 2023 Jan A C
02Feb2023 2023 Feb A C
02Feb2023 2023 Feb A P
03Feb2023 2023 Feb B C
21Feb2023 2023 Feb C C
24Feb2023 2023 Feb C C
27Feb2023 2023 Feb C P
;

data want;
set test;
by org yymm;
if first.yymm
then do;
  comp = 0;
  n = 1;
end;
else n + 1;
comp + (status = "C");
if last.yymm;
mtd = comp / n;
format mtd percent7.2;
keep org yymm mtd;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Aug 2023 13:32:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887865#M350776</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-08-04T13:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: MTD %</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887871#M350778</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As per your logic i am getting below results.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vnreddy_1-1691157150661.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86442iD946700DE9360DA4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vnreddy_1-1691157150661.png" alt="vnreddy_1-1691157150661.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to see both (complete) C and (Pending) P status for e.g., from source data for Org A in Feb we have total 2 rows out of which 1 is complete and 1 is pending.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 13:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887871#M350778</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2023-08-04T13:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: MTD %</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887873#M350779</link>
      <description>&lt;P&gt;Create a second variable that evaluates the other condition (status="P").&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 14:02:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887873#M350779</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-08-04T14:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: MTD %</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887881#M350783</link>
      <description>&lt;P&gt;Assuming you want a report, I would play with PROC TABULATE.&amp;nbsp; Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=test order=data missing;
  class Year Month Org Status ;
  tables Year*Month*Org*Status,pctn&amp;lt;Status&amp;gt;='Per_comp' ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Returns:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Tabulate.PNG" style="width: 257px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86444iFC65548CB26F2A89/image-size/large?v=v2&amp;amp;px=999" role="button" title="Tabulate.PNG" alt="Tabulate.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 14:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887881#M350783</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-08-04T14:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: MTD %</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887885#M350786</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;apart from tabular is there any other way of getting it in list table.&lt;/P&gt;
&lt;P&gt;I need to join this table to an another table.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 14:30:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887885#M350786</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2023-08-04T14:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: MTD %</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887887#M350788</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/301412"&gt;@vnreddy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;apart from tabular is there any other way of getting it in list table.&lt;/P&gt;
&lt;P&gt;I need to join this table to an another table.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, TABULATE has an out= option that will write an output dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=test order=data missing out=want;
  class Year Month Org Status ;
  tables Year*Month*Org*Status,pctn&amp;lt;Status&amp;gt;='Per_comp' ;
run ;

proc print data=want ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 14:33:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MTD/m-p/887887#M350788</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-08-04T14:33:10Z</dc:date>
    </item>
  </channel>
</rss>

