<?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: ODS PDF: New PDF file for each group. in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403690#M19591</link>
    <description>&lt;P&gt;1. How are the reports different? If you had to copy/paste the code below and change it for each report, how would it change?&lt;/P&gt;
&lt;P&gt;2. Have you looked at the NEWFILE option in ODS PDF? That's one option, the other is a MACRO. Here's a basic tutorial on how to write a macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need more examples, I suggest LexJansen or searching on here, there's a lot of examples of this type of reporting aroudn.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Oct 2017 20:32:56 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-10-12T20:32:56Z</dc:date>
    <item>
      <title>ODS PDF: New PDF file for each group.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403685#M19590</link>
      <description>&lt;P&gt;Hello People!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a task to make PDF reports, one for each group name. Each Group name has to have two reports namely "Care Level Status" and "Case Open/close&amp;nbsp;Status". Below code works absolutely fine in creating two PDF files one for each kind of Report.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Generating Reports*/
PROC SQL;
CREATE TABLE REPORT_3 AS
SELECT PARENT_GROUP, CARE_LEVEL_DESC, COUNT(DISTINCT(MHN)) AS MEMBER_COUNT
FROM WORK.CASES_FINAL_2015
GROUP BY PARENT_GROUP, CARE_LEVEL_DESC
ORDER BY PARENT_GROUP, CARE_LEVEL_DESC;
QUIT;

PROC SQL;
CREATE TABLE REPORT_4 AS
SELECT PARENT_SHP_GROUP_NUM, PARENT_GROUP, CASE_STATUS_DESC, 
COUNT(CASE_STATUS_DESC) as total_cases
FROM WORK.CASES_FINAL_2015
GROUP BY PARENT_SHP_GROUP_NUM, PARENT_GROUP, CASE_STATUS_DESC;
QUIT;

/*Printing PDF*/
%let tdate =  %sysfunc(date(),mmddyy10.);
%let ttime= %sysfunc(time(),timeampm11.);

ods escapechar='^';
options nodate nonumber colorprinting=yes;
ods pdf file="C:\Users\garga\Documents\SAS POC\Creating PDF\test3.pdf" style= styles.Ocean newfile=bygroup;
title j=right "^S={preimage='\\lap301006shp\Users\garga\Documents\SAS POC\Creating PDF\SECURITY.PNG'}";
title2 H=6.0 J=C F='Times New Roman' "Marshfield Clinic";
title3 H=3.0 J=C F='Times New Roman' "As of &amp;amp;tdate &amp;amp;ttime";
footnote1 H=1.5 J=L F='Times New Roman' "Creation Date:  &amp;amp;tdate";
footnote2 H=1.5 J=L F='Times New Roman' "Please contact isdata@marshfieldclinic.org with any questions or concerns with this report.";
footnote3 h=10pt f=Arial j=right '^{thispage}';
proc report data=work.report_3
	STYLE(REPORT) = [RULES = NONE FRAME = VOID ];
	COLUMNS PARENT_GROUP care_level_desc MEMBER_COUNT;
	define PARENT_GROUP/GROUP ORDER style(header)=[background = skyblue font_size = 12pt foreground = white];
	define care_level_desc /'CASE STATUS' style(header)=[background = skyblue font_size = 12pt foreground = white];
	Define MEMBER_COUNT /'TOTAL CASES' style(header)=[background = skyblue font_size = 12pt foreground = white];
	BREAK AFTER PARENT_GROUP/ SUMMARIZE PAGE;
run;
proc report data=work.report_4 
	STYLE(REPORT) = [RULES = NONE FRAME = VOID ];
	COLUMNS PARENT_GROUP CASE_STATUS_DESC TOTAL_CASES;
	define PARENT_GROUP/GROUP ORDER style(header)=[background = skyblue font_size = 12pt foreground = white];
	define CASE_STATUS_DESC /'CASE STATUS' style(header)=[background = skyblue font_size = 12pt foreground = white];
	Define TOTAL_CASES /'TOTAL CASES' style(header)=[background = skyblue font_size = 12pt foreground = white];
	BREAK AFTER PARENT_GROUP/ SUMMARIZE PAGE;
run;
ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What I am looking for is One PDF file for each group. Meaning to say if I have 30 groups in my table, then I want one PDf for each group and each PDF file will have two report tables. It doesn't matter if they are side to side or One after other.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Any help is much appreciated. I have been trying it for two days now and I have tried everything I could. There are other posts in the forum which helped but nothing is helping with this kind of specific task.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 20:16:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403685#M19590</guid>
      <dc:creator>Abhi_Garg</dc:creator>
      <dc:date>2017-10-12T20:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: ODS PDF: New PDF file for each group.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403690#M19591</link>
      <description>&lt;P&gt;1. How are the reports different? If you had to copy/paste the code below and change it for each report, how would it change?&lt;/P&gt;
&lt;P&gt;2. Have you looked at the NEWFILE option in ODS PDF? That's one option, the other is a MACRO. Here's a basic tutorial on how to write a macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need more examples, I suggest LexJansen or searching on here, there's a lot of examples of this type of reporting aroudn.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 20:32:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403690#M19591</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-12T20:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: ODS PDF: New PDF file for each group.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403691#M19592</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/two-tables-in-ods-pdf-bygroup/m-p/253480" target="_blank"&gt;https://communities.sas.com/t5/ODS-and-Base-Reporting/two-tables-in-ods-pdf-bygroup/m-p/253480&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/Producing-PDFs-per-by-Group/m-p/322352" target="_blank"&gt;https://communities.sas.com/t5/ODS-and-Base-Reporting/Producing-PDFs-per-by-Group/m-p/322352&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 20:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403691#M19592</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-12T20:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: ODS PDF: New PDF file for each group.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403697#M19593</link>
      <description>&lt;P&gt;The two reports aren't much different. they both come from the same table (CASE_FINAL_2015). As you can see in the very beginning&amp;nbsp;of the code, I have two proc SQL statements that are generating these two report tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The main table has following columns:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="10-12-2017 3-46-19 PM.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15835iD1BEB1C9F88AD0A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="10-12-2017 3-46-19 PM.png" alt="10-12-2017 3-46-19 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So report 1 is basically Counting distinct MHN for Care_Level_DESC for each Parent_Group&lt;/P&gt;&lt;P&gt;and report 2 is counting Case_Status_desc for each Parent Group.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 20:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403697#M19593</guid>
      <dc:creator>Abhi_Garg</dc:creator>
      <dc:date>2017-10-12T20:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: ODS PDF: New PDF file for each group.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403715#M19594</link>
      <description>&lt;P&gt;&lt;STRONG&gt;If you had to copy/paste the code below and change it for each report, how would it change?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;This is key to determine how to automate something.&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 21:39:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403715#M19594</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-12T21:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: ODS PDF: New PDF file for each group.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403925#M19598</link>
      <description>&lt;P&gt;If I had to change the code (speaking in most layman's term), the group number will change for each of the reports.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the code from the thread you shared. I get the concept, that I'll have to run the macro for the total number of Group count.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro reporting;
proc sql;
select distinct(PARENT_SHP_GROUP_NUM) into :grpnum SEPARATED by "|"
from work.report_3;
quit;&lt;BR /&gt;/*Need help here*/&lt;BR /&gt;/*Do for the length of Array -- grpnum*/&lt;BR /&gt;/*1) Make a PDF file for the Group Num*/&lt;BR /&gt;/*2) Run the report1 for the GroupNum*/&lt;BR /&gt;/*3) Run the report2 for the Group Num*/&lt;BR /&gt;/*end*/
%mend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can you please help me with the comment&amp;nbsp;section?? I am not sure how do&amp;nbsp;I parse each value of the array in Macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 13:47:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403925#M19598</guid>
      <dc:creator>Abhi_Garg</dc:creator>
      <dc:date>2017-10-13T13:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: ODS PDF: New PDF file for each group.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403953#M19600</link>
      <description>&lt;P&gt;&lt;A href="http://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=n1qvxz5u3uru7yn1nk7q64ohvwak.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=n1qvxz5u3uru7yn1nk7q64ohvwak.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 14:41:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-New-PDF-file-for-each-group/m-p/403953#M19600</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-13T14:41:39Z</dc:date>
    </item>
  </channel>
</rss>

