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


Below is my proc tabulate code.  I'd like the first variable in the table, the page variable 'cohort', to print with vertical alignment to save space.   Can someone tell me how to do it?  I've searched far and wide and have not found an answer yet.   

Bill

 

****************   code  ********************

proc tabulate data =&input f=4.0 S=[just=c cellwidth=75]; 

var Col1;
class cohort criterion instrument /ORDER=DATA ;
class _name_ ;
table cohort*instrument*criterion all={label='Total' s=[just=R background=lightblue]}*{s=[just=C background=lightblue]} ,(_name_='Level' ALL)*Col1=" "*(sum="N"*(f=cnum.) ROWPCTSUM="%"*f=mypct. ) /box=_PAGE_; 
BY instrument NOTSORTED; 
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
paulkaefer
Lapis Lazuli | Level 10

This paper suggests using VJUST. From the documentation, looks like you can specify VJUST=TOP, BOTTOM, or MIDDLE.

View solution in original post

7 REPLIES 7
paulkaefer
Lapis Lazuli | Level 10

This paper suggests using VJUST. From the documentation, looks like you can specify VJUST=TOP, BOTTOM, or MIDDLE.

BillB007
Obsidian | Level 7

I actually looked at that paper already and never noticed that line.   It was right in front of my face!   Thanks!

BillB007
Obsidian | Level 7

Update after actually trying the suggestion.  Specifying Vjust does't work the way I want.  It locates the horizontal text at the top, center or bottom of the box.  I want to rotate the text so the text is printed vertically.     I'm still stuck!    Any other ideas?

 

Text should be like this:

 

A

n

s

w

e

r

 

and not like this.   Answer

paulkaefer
Lapis Lazuli | Level 10

Ah, so you want rotated text. Try this solution.

BillB007
Obsidian | Level 7

Thanks.  Can't get that to work, it gives an error message, maybe because I'm using this for a PDF output and that article is for an Excel worksheet?   

 

I just created the style using this code from the article:

------------------   code from the suggested article to create a rotated text style -----------------------

proc template;
define style styles.mystyle;
parent=styles.default;
style vertical_header from header /
tagattr = 'rotate:90'
;
end;
run;

------------------   end of code from the suggested article to create a rotated text style -----------------------

 

 

Then I inserted that style where I want it, in the values for the cohort column.   Gives an error.   Not clear that proc tabulate will allow me to use styles that I create, or did I skip a step??

 

------------------------   my proc tabulate code to print a pdf file  --------------------------------

proc tabulate data =&input f=4.0 S=[just=c cellwidth=70]; 
var Col1;
class cohort criterion instrument /ORDER=DATA ;
class _name_ ;
classlev cohort /style=[vertical_header]; 
table cohort*instrument*criterion all={label='Total' s=[just=R background=lightblue]}*{s=[just=C background=lightblue]} ,(_name_='Level' ALL)*Col1=" "*(sum="N"*(f=cnum.) ROWPCTSUM="%"*f=mypct. ) /box=_PAGE_; 
BY instrument NOTSORTED; 
run;

 

paulkaefer
Lapis Lazuli | Level 10

Try including it in the PROC TABULATE call instead:

 

proc tabulate data=tabhow style=[vertical_header];

via this paper.

BillB007
Obsidian | Level 7
Can't make that work either. I don't think it would do what I want even if
it did work, it would apply to the entire table. I only want the values for
one of the three class columns to have vertical text. I want all the
headers to be normal and the other two class columns to have normal headers
and values. This is done in proc tabulate by using a classlev statement
and assigning the formatting there. Maybe this just can't be done.



##- Please type your reply above this line. Simple formatting, no
attachments. -##

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 7 replies
  • 4768 views
  • 2 likes
  • 2 in conversation