IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SAS cells within a output report


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Aug 14, 2014 11:48 pm
Reply with quote

Hi,
I have a requirement to generate a report from the below input, using SAS.

Code:
Hour          Count
1                   3
2                   4
3                   5
4                   1

the expected output is in the attachment. I understand that many people are unable to see attachments, but I don't know any other way to format & show the expected output.

Could you let me know how this could be done. I am aware that a cell can be highlighted by using style element, but dont know how to split a single cell into 5 subcells.

the maximum value of count is 5.

Thanks & Regards,
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Aug 15, 2014 3:35 am
Reply with quote

If you have SAS/GRAPH, this is simply one of the options of PROC CHART (look at HBAR). If you do not have SAS/GRAPH, you can generate a similar report yourself by using nested IF statements or SELECT-WHEN in your DATA step.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Aug 18, 2014 1:54 pm
Reply with quote

Using ODS you can change the background colour of the cells depending on the number.

I've done something very similar in the past and don't have access to the code at work icon_cry.gif

Will try and post it later this evening if I remember icon_razz.gif

The theory is that you have 5 cells, not one that has been sub divided and do the change for 1 through n and then leave the rest as default background, or set it to default as a precaution as I believe it sets the value for following cells in the column.

Lucky you - I can access the code from my mobile
Code:

If condition then call define(_COL_,"style","style=[backgroundcolor=yellow]");
else ........... define it another colour
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Mon Aug 18, 2014 5:56 pm
Reply with quote

Nice.. Thank you Rober & Expat.
I will take this idea and try implementing in the reporting part.

Regards,
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Aug 21, 2014 3:18 pm
Reply with quote

Finally found the right code icon_biggrin.gif

The cell background is changed via a compute in the ODS process.

Code:

  compute CA13;
    if CL13 LE 1 then call define(_col_,"style","style=[backgroundcolor=yellow]");
                 else call define(_col_,"style","style=[backgroundcolor=lightblue]");
  endcomp;
  compute CA12;
    if CL12 LE 1 then call define(_COL_,"style","style=[backgroundcolor=yellow]");
                 else call define(_COL_,"style","style=[backgroundcolor=lightblue]");
  endcomp;
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Aug 21, 2014 6:43 pm
Reply with quote

Thank you again. This would make a fine enhancement to the PROC REPORT. :-)
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Aug 21, 2014 7:11 pm
Reply with quote

Just one point that took me forever and an age to find out using Trial and lots of Error ....

If you use a control variable like I did CL13 / CL12
Code:

/* Change background colour of cells depending on a different variable - - -
   - - - Include the control variables in the output, but define them as NOPRINT   
   - - - ALSO - PLACE THE CONTROL VARIABLES BEFORE THE DISPLAY VARIABLES IN THE COLUMN STATEMENT */

  compute CA13;
    if CL13 LE 1 then call define(_col_,"style","style=[backgroundcolor=yellow]");
                 else call define(_col_,"style","style=[backgroundcolor=lightblue]");
  endcomp;
  compute CA12;
    if CL12 LE 1 then call define(_COL_,"style","style=[backgroundcolor=yellow]");
                 else call define(_COL_,"style","style=[backgroundcolor=lightblue]");
  endcomp;
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
No new posts XDC SDSF output to temp dataset CLIST & REXX 4
No new posts Need help on formatting a report DFSORT/ICETOOL 14
Search our Forums:

Back to Top