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;
This paper suggests using VJUST. From the documentation, looks like you can specify VJUST=TOP, BOTTOM, or MIDDLE.
This paper suggests using VJUST. From the documentation, looks like you can specify VJUST=TOP, BOTTOM, or MIDDLE.
I actually looked at that paper already and never noticed that line. It was right in front of my face! Thanks!
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
Ah, so you want rotated text. Try this solution.
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;
Try including it in the PROC TABULATE call instead:
proc tabulate data=tabhow style=[vertical_header];
via this paper.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.