BookmarkSubscribeRSS Feed
mona4u
Lapis Lazuli | Level 10

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
9 REPLIES 9
ballardw
Super User

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.

PaigeMiller
Diamond | Level 26

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
mona4u
Lapis Lazuli | Level 10

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

Cynthia_sas
SAS Super FREQ
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
mona4u
Lapis Lazuli | Level 10

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

PaigeMiller
Diamond | Level 26

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
mona4u
Lapis Lazuli | Level 10

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

 type
valueCOL1COL2
33831
PaigeMiller
Diamond | Level 26

 

 

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
ballardw
Super User

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;    

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 1203 views
  • 3 likes
  • 4 in conversation