DATA Step, Macro, Functions and more

Color Tabulate Header

Accepted Solution Solved
Reply
Super Contributor
Posts: 497
Accepted Solution

Color Tabulate Header

[ Edited ]


I am trying to add the commented line and running into syntax errors.  How do I color a tabular header like a proc report header?  This is the same line that I use successfully in proc report.

 

 

title 'Fall 2015 UG Engineering Admissions Status (enrolled)';
proc tabulate data= eaar.summary_opds_stu_admissions /*style(header)=[background=#969491 color=white]*/ out= Fall_UG_Admission_Status ;
class application_type;
var enrolled;
table ( application_type= ' ' all) * N = ' ';
where college = 'EG' and academic_period_desc = 'Fall 2015' and
application_level = 'Undergraduate' and enrolled = 1;
run;


Accepted Solutions
Solution
‎09-28-2016 01:49 PM
Super User
Posts: 11,343

Re: Color Tabulate Header

Posted in reply to DavidPhillips2

Tabulate takes a bit more work and you need to address things a bit differently. See if this come close

title 'Fall 2015 UG Engineering Admissions Status (enrolled)';
proc tabulate data= eaar.summary_opds_stu_admissions out= Fall_UG_Admission_Status ;
   class application_type /style=[background=#969491 color=white];
   classlev application_type /style=[background=#969491 color=white];
   keyword all /style=[background=#969491 color=white];
   var enrolled;
   table ( application_type= ' ' all) * N = ' ';
   where college = 'EG' and academic_period_desc = 'Fall 2015' and
      application_level = 'Undergraduate' and enrolled = 1;
run;

View solution in original post


All Replies
Solution
‎09-28-2016 01:49 PM
Super User
Posts: 11,343

Re: Color Tabulate Header

Posted in reply to DavidPhillips2

Tabulate takes a bit more work and you need to address things a bit differently. See if this come close

title 'Fall 2015 UG Engineering Admissions Status (enrolled)';
proc tabulate data= eaar.summary_opds_stu_admissions out= Fall_UG_Admission_Status ;
   class application_type /style=[background=#969491 color=white];
   classlev application_type /style=[background=#969491 color=white];
   keyword all /style=[background=#969491 color=white];
   var enrolled;
   table ( application_type= ' ' all) * N = ' ';
   where college = 'EG' and academic_period_desc = 'Fall 2015' and
      application_level = 'Undergraduate' and enrolled = 1;
run;
Super Contributor
Posts: 497

Re: Color Tabulate Header

Ballardw,

Thanks that worked great.

Super Contributor
Posts: 497

Re: Color Tabulate Header

Posted in reply to DavidPhillips2

In this case how do I color the cell in the top left?

 

 

proc tabulate data= mytable;
class student_classification1 department degree_level / style=[background=#969491 color=white];
classlev student_classification1 department degree_level / style=[background=#969491 color=white];
keyword all / style=[background=#969491 color=white];
var students_enrolled;
table department = ' ' all, (degree_level=' ' * student_classification1= ' ' all) * N = ' ';
run;

Super User
Posts: 11,343

Re: Color Tabulate Header

Posted in reply to DavidPhillips2

Are you referring to the often empty box in the upper left that is addressed using BOX in the table options? BOX allows style options as well so something like:

 

proc tabulate data= mytable;
   class student_classification1 department degree_level / style=[background=#969491 color=white];
   classlev student_classification1 department degree_level / style=[background=#969491 color=white];
   keyword all / style=[background=#969491 color=white];
   var students_enrolled;
   table department = ' ' all, 
        (degree_level=' ' * student_classification1= ' ' all) * N = ' '
        /box = [style=[background=#969491 color=white]]
   ;
run;
Super User
Posts: 11,343

Re: Color Tabulate Header

Posted in reply to DavidPhillips2

If you are going to want to use the same appearnce often I would be very tempted create a custom ODS style. Many of the SAS developed styles such as Analysis, Meadow, Festival and others will have the column and row header area appear with different color background if not text foreground. Use one of those close to your other appearance needs and use in as the basis for your report output.

Super Contributor
Posts: 497

Re: Color Tabulate Header

[ Edited ]

On the subject of formatting is there a keyword that removes blank values form the header section?  I’m blanking out the space for values like N but the space remains.

 

For example:

 

title 'Fall 2015 UG Engineering Admissions Status (enrolled)';
proc tabulate data= mytable style =[font_size=1] out= Fall_UG_Admission_Status missing;
class application_type / style=[background=#969491 color=white font_size=1];
classlev application_type / style=[background=#969491 color=white font_size=1];
var enrolled / style =[font_size=1];
table ( application_type= ' ' * all= ' ') * N = ' ' / row=float;
run;

Super User
Posts: 11,343

Re: Color Tabulate Header

Posted in reply to DavidPhillips2

You'll either need to provide some example data to run the code against to see what your output is or provide a picture.

I'm not sure which potential blanks you may be referring to.

 

Since your code doesn't have a row dimension I'm not sure what the affect of row=float might be.

 

I note that you are now show

application_type= ' ' * all= ' '

where previously you had

application_type= ' '   all= '

 

Did you intend to nest the all within levels of application_type?

Super Contributor
Posts: 497

Re: Color Tabulate Header

[ Edited ]

The output shown is what I am aiming for but the blanks make it weird.  I’m trying to remove the blanks from the top box.  I attached a screenshot.


a.png
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 464 views
  • 1 like
  • 2 in conversation