DATA Step, Macro, Functions and more

proc report with ODS layout

Posts: 24

proc report with ODS layout

Hi All,


I am creating patient profile data where i need to place all data for one subject on same page but due to number of rows and number of columns in dataset i am not able to accomodate on same page.


I need to place data from first two dataset on first page and data from another two dataset on second page and data from last datasets on third page.


Can you please guide how can we do this ?




Frequent Contributor
Posts: 75

Re: proc report with ODS layout

Can you provide a sample of your data and the code you have tried so far? Fitting data on to pages is generally an exercise in adjusting font size, column label, data formatting, column widths, co-ordinates of regions, etc.

Super User
Posts: 10,487

Re: proc report with ODS layout

What ODS destination are you using?

And does this have to fit on actual paper or a logic page in a document? If not intended for print you can set options Papersize to a height and width that could work.

Though you my be chasing a goal that is difficult to obtain due to the nature of your data. As soon as you solve this for a patient with 100 rows of data you'll get a new one with 200 rows.


This mixing of data sets is a headache in that you either are going to get into macro coding to loop over patients and then do the output for each patient or a radical restructure of data.

Here is some pseudo code as an example of a macro approach:


%macro mix;

proc sql;

    select distinct PatientID into : Patients separated by " "

    from yourdatasetwithpatientids;


%let PatCount=&sqlobs; /* this will have the number of unique patient ids*/

%do i = 1 %to &Patcount;

   %let pat = %scan(&patients,&i); /* patient id for this report*/

    <process first data set with WHERE patientid = "&pat"   or =pat depending on whether your id is character or numeric>

    <process second dataset with Where on the patientid as above>

    <process third dataset with where as above>






Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation