The SAS Output Delivery System and reporting techniques

Upcase Column headings

Reply
Contributor
Posts: 69

Upcase Column headings

Is there a way to have all the column headings appear in uppercase on my ods output spreadsheet?

With help from sas communities I have been able to change the font size and make it bold, but now I want them all to appear in uppercase. 

Can that be done?

thank you,

Super User
Posts: 10,516

Re: Upcase Column headings

That may require changing the LABEL of the variables involved or the text in the code generating the output if specifying the headings as part of define or table statements (or similar in other procs).

If you don't want to permanently change a label in a dataset almost every procedure recognizes the label statement as an option.

Super Contributor
Posts: 358

Re: Upcase Column headings

Hi,

What procedure(s) are you using to create the spreadsheets?  In some, like PROC TABULATE, you can code the column label in the procedure, while others use the LABEL for the variable or the variable name

Super User
Posts: 9,682

Re: Upcase Column headings

You mean change column name or column label ?

Contributor
Posts: 69

Re: Upcase Column headings

I am using proc template to make a custom format for the font size, type, etc.

I just wanted to make the column label in all uppercase, right now in my code for all my tables I have used uppercase for all variables names but when I output some are still lower case or mixed case.  I just want all the column labels to be in upper case.

This is only for the column labels, not the data in the table.

Thanks,

Super User
Posts: 9,682

Re: Upcase Column headings

I would make a macro or use call execute to rewrite these label again . I am not familiar with proc template , don't know if it have such ability .

Xia Keshan

Super User
Super User
Posts: 7,411

Re: Upcase Column headings

Hi,

data _null_;

  set sashelp.vcolumn (where=(libname="SASHELP" and memname="BMT")) end=last;

  if _n_=1 then call execute('data work.bmt; set sashelp.bmt; label ');

  call execute(' '||strip(name)||'="'||upcase(strip(label))||'"');

  if last then call execute(';run;');

run;

Respected Advisor
Posts: 3,777

Re: Upcase Column headings

There is no need to replace the entire data set to change the meta data.  That's a big hammer for such a small nail.

SAS Super FREQ
Posts: 8,743

Re: Upcase Column headings

Hi:

  You did not say what kind of template you were using. I assume it is a style template. You can't do a change to upcase in the style template -- with the style template you are changing the style characteristics -- color, font, font-face of the column header -- but you cannot change the value of the header in a style template. While you might be able to make the type of change you want in a tagset template, that is a lot of work. AND, you have to know that your destination of choice even uses TAGSET templates. And, then there would be changing the tagset template, which I wouldn't recommend for something like this.  it is hardly worth it, given the fact that most SAS procedures support the LABEL statement or have internal ways to alter the label -and- the fact that RW9 has provided you a nice bit of code that would, in fact, do what you want.

cynthia

Respected Advisor
Posts: 3,777

Re: Upcase Column headings

You mention variable names.  If your column heading are simply the variable names you might be able to use OPTIONS VALIDVARNAME=UPCASE and achieve your goal.  You would also need OPTIONS NOLABEL if your variables have labels.

options validvarname=any label=0;
proc report nofs data=sashelp.heart(obs=10) list;
  
columns _all_;
   run;
options validvarname=upcase label=0;
proc report nofs data=sashelp.heart(obs=10) list;
  
columns _all_;
   run;
options validvarname=any label=1;

3-20-2015 8-18-16 AM.png
Ask a Question
Discussion stats
  • 9 replies
  • 1246 views
  • 1 like
  • 7 in conversation