The SAS Output Delivery System and reporting techniques

changind the columns appearance in proc report

Reply
Regular Contributor
Posts: 165

changind the columns appearance in proc report

[ Edited ]

I'm trying to change the appearance for the columns in my report 

 I used this code 

 

proc report data=table4;
column Readable_Time_Points case_assigned Time_points_read Time_points_complete off_study off_study_total Time_Points_Pending ;
define Readable_Time_Points/ "Readable Time Points";
define case_assigned/ "Cases Assigned";
define Time_Points_Pending/ "Time Points Pending";
define off_study/ "Off_study cases requiring adjudication";
define off_study_total/ "Total cases completed(off_study)";


run;

 

and this is my current result 

Readable Time Points

Cases AssignedTime_points_readTime_points_completeOff_study cases requiring adjudicationTotal cases completed(off_study)Time Points Pending
9729300009

and this is the result that I aim for or something simillar

 

Time Points Read/Complete: (Complete reads/Contracted) 293009.7%
Readable Time Points:9
Cases Assigned:7
Time Points Pending7
Off-study cases requiring adjudication:0
Total cases completed (off- study):0
Super User
Posts: 13,876

Re: changind the columns appearance in proc report

Proc report doesn't like to mix values within a single column unless it is a summary of the column. It might be possible to generate some of that output with Proc tabulate as it will allow mixing columns a bit but does get picky about what needs to be included to do summaries and it appears that your desired result may not be practical (without data it is hard to tell).

 

If you provide example input data in the form of a data step you might get a tested solution.

Respected Advisor
Posts: 3,249

Re: changind the columns appearance in proc report

You could re-arrange the data in a data step before PROC REPORT, which would then allow PROC REPORT to do different things than it normally does. So the only thing PROC REPORT would do is to create a table, it would not be doing the analysis of the data.


Nevertheless, this would take a bit of work in the data step to get PROC REPORT to produce the final report as you want it.

--
Paige Miller
Regular Contributor
Posts: 165

Re: changind the columns appearance in proc report

Posted in reply to PaigeMiller

I already analysed my data before proc report but I want to change the report criteria that what I want   

SAS Super FREQ
Posts: 9,423

Re: changind the columns appearance in proc report

Hi:
PROC REPORT will not restructure your data as you envision. You will need to pre-process your data so that, for example, you have multiple rows in the structure you want, instead of just one row of multiple variables.

cynthia
Regular Contributor
Posts: 165

Re: changind the columns appearance in proc report

[ Edited ]
Posted in reply to Cynthia_sas

That's exactly what I want to do but I don't know how to do it 

Respected Advisor
Posts: 3,249

Re: changind the columns appearance in proc report

[ Edited ]

Since you haven't shown us your data, we can only guess at what you have, and so I would say you could create code that looks something like this (not a complete example)

 

data table5;
    set table4;
    length type $ 16;
    value=readable_time_points;
    type='COL1';
    output;
    value=cases_assigned;
    type='COL1';
    output;
    value=time_points_read;
    type='COL1';
    output;
    value=time_points_complete;
    type='COL2';
    ouptut;
run;

proc report data=table5;
    columns value type;
    define type/across;
run;
--
Paige Miller
Regular Contributor
Posts: 165

Re: changind the columns appearance in proc report

Posted in reply to PaigeMiller

That's the result that I got from your code and it is not correct 

 type
valueCOL1COL2
33831
Respected Advisor
Posts: 3,249

Re: changind the columns appearance in proc report

[ Edited ]

 

 

There is a mistake in what I wrote, which should say

 

data table5;
    set table4;
    length type $ 16 label $ 24;
    label='readable_time_points';
    type='COL1';
    value=readable_time_points;
    output;
    label='cases_assigned';
    type='COL1';
    value=cases_assigned;
    output;
    label='time_points_read_complete';
    type='COL1';
    value=time_points_read;
    output;
    label='time_points_read_complete';
    type='COL2'
    value=time_points_complete;
    ouptut;
run;

proc report data=table5;
    columns label type,value;
    define type/across;
    define value/analysis sum;
run;

I have not much to go on, as you haven't shared a reasonable subset of your data so we can see what it looks like.

 

Now, you show us a reasonable portion of your data in table4.

--
Paige Miller
Super User
Posts: 13,876

Re: changind the columns appearance in proc report

Here is a very old school approach:

data garbage;
    input 
      Readable_Time_Points 
      case_assigned 
      Time_points_read 
      Time_points_complete 
      off_study 
      off_study_total 
      Time_Points_Pending 
    ;
datalines;
9 7 29 300 0 0 9
;
run;

data _null_;
   set garbage;
   file print;
   rate= Time_points_read/Time_points_complete;
   put @1 "Time Points Read/Complete: (Complete reads/Contracted)" 
       @56 Time_points_read
       @60 Time_points_complete
       @65 rate percent7.1
   ;
   put @1 "Readable Time Points:" 
       @56 Readable_Time_Points
   ;
   put @1 "Cases Assigned:"
       @56 case_assigned
   ;
   put @1 "Time Points Pending"
       @56 Time_Points_Pending
   ;
   put @1 "Off-study cases requiring adjudication:"
       @56 off_study
   ;
   put @1 "Total cases completed (off- study):"
       @56  off_study_total
   ;
run;    
Ask a Question
Discussion stats
  • 9 replies
  • 187 views
  • 3 likes
  • 4 in conversation