Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SAS cells within a output report

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Thu Aug 14, 2014 11:48 pm    Post subject: SAS cells within a output report
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: 7913
Location: Bellevue, IA

PostPosted: Fri Aug 15, 2014 3:35 am    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Mon Aug 18, 2014 1:54 pm    Post subject:
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: 1445
Location: Azeroth

PostPosted: Mon Aug 18, 2014 5:56 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu Aug 21, 2014 3:18 pm    Post subject:
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: 1445
Location: Azeroth

PostPosted: Thu Aug 21, 2014 6:43 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu Aug 21, 2014 7:11 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Detailed Transaction History report f... Kyle Carroll CICS 5 Tue Oct 18, 2016 12:42 am
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm
This topic is locked: you cannot edit posts or make replies. output data in CSV Format janmejay DFSORT/ICETOOL 3 Sat Oct 15, 2016 2:16 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us