<?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: Combine multiple PROC REPORT tables and report them on one page in a PDF. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combine-multiple-PROC-REPORT-tables-and-report-them-on-one-page/m-p/881658#M348364</link>
    <description>&lt;P&gt;Thank you for your reply! Unfortunately, I do not understand from the documentation where to put the ods startpage statement to receive the wanted result. Could you help me out and modify the code?&lt;/P&gt;</description>
    <pubDate>Wed, 21 Jun 2023 08:20:19 GMT</pubDate>
    <dc:creator>_Manhattan</dc:creator>
    <dc:date>2023-06-21T08:20:19Z</dc:date>
    <item>
      <title>Combine multiple PROC REPORT tables and report them on one page in a PDF.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-multiple-PROC-REPORT-tables-and-report-them-on-one-page/m-p/880603#M347940</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to generate a PDF document that includes two pieces of information. Firstly, information about a variable (e.g., label, coding, items), and secondly, frequency tables. The challenge I'm facing is that I have multiple variables or variable stems (e.g., Var1), and for each of these variables, I want to create multiple frequency tables (e.g., Var1a, Var1b, Var1c). The issue I'm encountering is that I don't know how to report the corresponding frequency tables on the same page as the variable information for the variable stem (e.g., Var1). In the example code below, a PDF with 3 pages is generated, with the frequency tables (Var1a, Var1b, and Var1c) distributed across the 3 pages. However, I would like to print the three tables on page 1 alongside their variable stem (Var1) information. Does anyone know how I could structure the data and change my code so that I can report several proc report tables on one page/attach these tables to the variable information of the variable stem?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Data for Variable Information*/
data VariableInfo;
  input Variable $ Beschriftung $ Kodierung $;
  datalines;
Var1 Variable 10
Var2 Variable 20
Var3 Variable 30
;

/* Data for frequencies */
data ExampleData;
  input ID Var1a Var1b Var1c;
  datalines;
1 10 20 1
2 15 25 0
3 20 30 1
4 10 20 1
5 15 25 0
6 20 30 1
;


/* Generate frequencies and save them as separate tables */
%macro GenerateFrequencyTables;
  %let varlist = Var1a Var1b Var1c;

  %do i = 1 %to %sysfunc(countw(&amp;amp;varlist));
    %let variable = %scan(&amp;amp;varlist, &amp;amp;i.);

    proc freq data=ExampleData;
      tables &amp;amp;variable / out=freqtable&amp;amp;variable;
    run;
  %end;
%mend GenerateFrequencyTables;
%GenerateFrequencyTables;

/* Macro for a pdf with Variable Info and frequency tables */
%macro ReportFrequencyTables;
  ods pdf file="yourpath\ExampleFrequencyTables.pdf"; 

  %let varlist = Var1a Var1b Var1c;
  %let vari = Var1 Var2 Var3;
  
  %do i = 1 %to %sysfunc(countw(&amp;amp;varlist));
  
    %let variable = %scan(&amp;amp;varlist, &amp;amp;i.);
    %let varinfo = %scan(&amp;amp;vari, &amp;amp;i.);
    
    ods pdf startpage=now;
  	ods layout start width=19cm height=28cm;
  	
    proc report data=VariableInfo;
    where Variable contains "&amp;amp;varinfo";
    run;

    proc report data=FreqTable&amp;amp;Variable;
    column &amp;amp;variable COUNT PERCENT;
    run;
 
   
ods layout end;
%end;

ods pdf close; 
 
%mend ReportFrequencyTables;
%ReportFrequencyTables;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In case you are wondering why I am producing the frequency tables outside my ReportFrequencyTables Macro: That is because I am using (have to use) a predefined macro for frequencies in my report. But if it there is a solution that depends on generating the frequencies inside the ReportFrequencyTables macro, I will check if that is possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 09:48:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-multiple-PROC-REPORT-tables-and-report-them-on-one-page/m-p/880603#M347940</guid>
      <dc:creator>_Manhattan</dc:creator>
      <dc:date>2023-06-14T09:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple PROC REPORT tables and report them on one page in a PDF.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-multiple-PROC-REPORT-tables-and-report-them-on-one-page/m-p/880626#M347953</link>
      <description>&lt;P&gt;Assuming these two tables will fit on one page of your PDF file, you can use the option STARTPAGE=NO&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsug/n0mc4eolqoned0n16oy88mpj0e4g.htm#n0c86qqt1gatyun1s65f7mmtmwl7b" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsug/n0mc4eolqoned0n16oy88mpj0e4g.htm#n0c86qqt1gatyun1s65f7mmtmwl7b&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 12:12:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-multiple-PROC-REPORT-tables-and-report-them-on-one-page/m-p/880626#M347953</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-14T12:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple PROC REPORT tables and report them on one page in a PDF.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-multiple-PROC-REPORT-tables-and-report-them-on-one-page/m-p/881658#M348364</link>
      <description>&lt;P&gt;Thank you for your reply! Unfortunately, I do not understand from the documentation where to put the ods startpage statement to receive the wanted result. Could you help me out and modify the code?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 08:20:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-multiple-PROC-REPORT-tables-and-report-them-on-one-page/m-p/881658#M348364</guid>
      <dc:creator>_Manhattan</dc:creator>
      <dc:date>2023-06-21T08:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple PROC REPORT tables and report them on one page in a PDF.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-multiple-PROC-REPORT-tables-and-report-them-on-one-page/m-p/881667#M348371</link>
      <description>It is not ODS STARTPAGE&lt;BR /&gt;It is an option that you put in the ODS PDF statement.</description>
      <pubDate>Wed, 21 Jun 2023 09:42:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-multiple-PROC-REPORT-tables-and-report-them-on-one-page/m-p/881667#M348371</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-21T09:42:29Z</dc:date>
    </item>
  </channel>
</rss>

