<?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 Generate report in excel with product level wise and all the available month by using proc report in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Generate-report-in-excel-with-product-level-wise-and-all-the/m-p/685574#M79560</link>
    <description>&lt;P&gt;Hello Team ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sample dataset&amp;nbsp; and&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;Report&amp;nbsp; structure is attached here .&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have above requirement and need to create below report.&lt;/P&gt;&lt;P&gt;here we have 12 product like A,B and C ect. and i need to print each product in individual sheets like&lt;/P&gt;&lt;P&gt;if PRODUCT A then it should be in (sheet A) with only product A and&amp;nbsp; with All Available months like(01mar2020,01apr2020) in report structure.&lt;/P&gt;&lt;P&gt;if PRODUCT B then it should be in (sheet B) with only product B and&amp;nbsp; with All Available months like(01mar2020,01apr2020) in report structure..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help on this Problem.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Sep 2020 04:05:54 GMT</pubDate>
    <dc:creator>Itharaju</dc:creator>
    <dc:date>2020-09-22T04:05:54Z</dc:date>
    <item>
      <title>Generate report in excel with product level wise and all the available month by using proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Generate-report-in-excel-with-product-level-wise-and-all-the/m-p/685574#M79560</link>
      <description>&lt;P&gt;Hello Team ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sample dataset&amp;nbsp; and&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;Report&amp;nbsp; structure is attached here .&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have above requirement and need to create below report.&lt;/P&gt;&lt;P&gt;here we have 12 product like A,B and C ect. and i need to print each product in individual sheets like&lt;/P&gt;&lt;P&gt;if PRODUCT A then it should be in (sheet A) with only product A and&amp;nbsp; with All Available months like(01mar2020,01apr2020) in report structure.&lt;/P&gt;&lt;P&gt;if PRODUCT B then it should be in (sheet B) with only product B and&amp;nbsp; with All Available months like(01mar2020,01apr2020) in report structure..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help on this Problem.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 04:05:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Generate-report-in-excel-with-product-level-wise-and-all-the/m-p/685574#M79560</guid>
      <dc:creator>Itharaju</dc:creator>
      <dc:date>2020-09-22T04:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Generate report in excel with product level wise and all the available month by using proc repor</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Generate-report-in-excel-with-product-level-wise-and-all-the/m-p/685636#M79561</link>
      <description>&lt;P&gt;Since you already have an Excel spreadsheet, you should ask this question in a Microsoft-oriented forum, as it will involve VBA programming.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 09:27:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Generate-report-in-excel-with-product-level-wise-and-all-the/m-p/685636#M79561</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-22T09:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Generate report in excel with product level wise and all the available month by using proc repor</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Generate-report-in-excel-with-product-level-wise-and-all-the/m-p/686650#M79567</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I assume the report structure you described was only an example, otherwise you could maybe explain how you get 12 rows &lt;U&gt;with different amounts&lt;/U&gt; in your desired report structure out of 9 rows in your sample data set.&lt;/P&gt;
&lt;P&gt;Try this out:&lt;/P&gt;
&lt;PRE&gt;proc datasets lib=work kill nolist;run;quit;
proc format; 
  picture cstmdt (default=10)
    low - high = '%0D. %b %y' (datatype=date);
run; 

libname xl xlsx "C:\Users\&amp;amp;sysuserid.\Desktop\have.xlsx";

data have;
   length date $10;
   set xl.'Sheet1$D7:H16'n(rename=(amount1=amount1_xl amount2=amount2n_xl));
   length amount1 amount2 $12;
   *adjust formatting to get the desired output - keep printable characters for month etc;
   month=compress(month,,'kaid');
   monthn=input(month,date9.);
   date=put(monthn,cstmdt.);
   amount1=strip(put(amount1_xl,best.));
   amount2=strip(put(amount2n_xl,best.));
   productC=compress(product,,'kaid');
   drop amount1_xl amount2n_xl;
run;

proc sort data=have out=work0; by productC monthn; run;

data work1;
   set work0;
   by productC monthn;
   *adjust formatting to get the desired output;
   retain count1 count2 value .;
   date1=date;
   if first.productC then count2+1;
   if first.monthn then do;
      value=1;
      count1+1;
      date='';
      output;
      call missing(product,month,flag,amount1,amount2);
      date=date1;
      output;
      call missing(date,value);
      output;
      output;
   end;
   else do;
      date='';
      output;
   end;
   drop date1;

   *write out;
   if last.productC then do;
      call execute('libname xl2 xlsx "C:\Users\&amp;amp;sysuserid.\Desktop\result.xlsx";');
      call execute('PROC SORT data=work1 out=xl2.sheet'||strip(put(count2,best.))||'(drop=monthn count1 count2 productC value); where productC eq "'||strip(productC)||'"; by count1 descending date descending value monthn product flag; run;');
      call execute('libname xl2 clear;');
   end;
run;

libname xl clear;&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;</description>
      <pubDate>Fri, 25 Sep 2020 09:02:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Generate-report-in-excel-with-product-level-wise-and-all-the/m-p/686650#M79567</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2020-09-25T09:02:54Z</dc:date>
    </item>
  </channel>
</rss>

