BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
abraham1
Obsidian | Level 7

Hi,

I am getting error while running the below code in log file.

Unrecognized option: ROTATE_HEADERS
Unrecognized option: HEIGHT

I want to change the column header from horizontal to vertical format. Also all the columns should contain constant height of 10 and width of 7.

Can you please help

data test;
  input pid age gender race event2 $;
  label
    pid = 'Patient ID'
    age = 'Patient age'
    gender='Sex'
    race = 'Race'
    event2='Event 2'
  ;
cards;
101 21 1 1 fever
102 21 2 1 fever
103 31 1 1 fever
104 43 2 1 fever
;
ods tagsets.excelxp file='D:/outputs/test.xls'   style=normal
      options( rotate_headers="45"
               height="60");
proc print data=test ; run;
ods tagsets.excelxp close;

me

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
data test;
  input pid age gender race event2 $;
  label
    pid = 'Patient ID'
    age = 'Patient age'
    gender='Sex'
    race = 'Race'
    event2='Event 2'
  ;
cards;
101 21 1 1 fever
102 21 2 1 fever
103 31 1 1 fever
104 43 2 1 fever
;
ods tagsets.excelxp file='c:\temp\test.xls'   style=normal 
options( Row_Heights='200,20,20,20,20,20,20' Default_Column_Width='10')
;
proc report data=test nowd style(header)={tagattr='rotate:90 ' }; 
run;
ods tagsets.excelxp close;

Ksharp_0-1666179309623.png

 

View solution in original post

5 REPLIES 5
ballardw
Super User

@abraham1 wrote:

Hi,

I am getting error while running the below code in log file.

Unrecognized option: ROTATE_HEADERS
Unrecognized option: HEIGHT

I want to change the column header from horizontal to vertical format. Also all the columns should contain constant height of 10 and width of 7.

 


Height of 10 what units? MM, CM, Feet, furlongs?

Your requirement may have issues with the amount of text you attempt to place in a given height/width combination.

You may want define more of what you expect for "vertical format" headers.

 

You might not be aware of the Proc Print option Heading= that has one form of vertical headings.

 

As an example run (regardless of destination)

proc print data=test heading=vertical ; run;

 

abraham1
Obsidian | Level 7
I have just added sample data for reporting. I need to export the output to excel file with ods tagset excelxp option with column header to be displayed in vertical format.
Tom
Super User Tom
Super User

Why would you want to use EXCELXP tagset instead of using the more recent EXCEL ods destination?

And if you are going to use that method why are you naming the file with .xls extension instead of .xml?  It is going to be an XML file.

 

I suspect you want to add a style to the VAR statement of your PROC PRINT to tell EXCEL to rotate the headers.

Here is a line from an old report of mine from years ago when EXCELXP was actually kind of current technology.

  var &vlist
   /style={tagattr="format:###,###,###"}
    style(header)={tagattr='rotate:90 format:text'}
  ;
Ksharp
Super User
data test;
  input pid age gender race event2 $;
  label
    pid = 'Patient ID'
    age = 'Patient age'
    gender='Sex'
    race = 'Race'
    event2='Event 2'
  ;
cards;
101 21 1 1 fever
102 21 2 1 fever
103 31 1 1 fever
104 43 2 1 fever
;
ods tagsets.excelxp file='c:\temp\test.xls'   style=normal 
options( Row_Heights='200,20,20,20,20,20,20' Default_Column_Width='10')
;
proc report data=test nowd style(header)={tagattr='rotate:90 ' }; 
run;
ods tagsets.excelxp close;

Ksharp_0-1666179309623.png

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 5 replies
  • 624 views
  • 2 likes
  • 4 in conversation