Hi,
This is my first post on these forums (I'm pretty sure), so I apologize if I've mis-categorized the post or if the question has already been answered (I couldn't find it if it has).
I'm learning PROC TABULATE, and I've gotten pretty far with it for day 1 (I think), but one thing I cannot get right is labeling my columns in the output as I wish.
Here's my current code, which does run and produces the numbers I expect to see:
proc format;
picture pct (round) low-high='009.99%';
run;
proc tabulate data=GRPR_PLC_CLM;
class RESERVING_LINE COVERAGE EFFECTIVEYEAR;
var Incurred_Loss__Ledger_ CC CHARGEDPREM_WITHCOMM;
table RESERVING_LINE*COVERAGE all
,(EFFECTIVEYEAR all)*((CC*f=comma12.)
(ChargedPrem_withComm*f=dollar12.)
(Incurred_Loss__Ledger_*f=dollar12.)
(Incurred_Loss__Ledger_*pctsum<ChargedPrem_withComm>*f=pct.));
title 'Coverages by Effective Year';
run;
The output looks like this:
The problem that I'm having is that I want the column which is currently labeled "Incurred Loss (Ledger)" with "PctSum" underneath it to read "Loss Ratio" where "Incurred Loss (Ledger)" is... and I don't much care if it still says PctSum under it or not.
I've tried a number of things so far and nothing seems to work. Does anybody have any suggestions for me?
Always check the docs 🙂
(Incurred_Loss__Ledger_='Loss Ratio' *pctsum<ChargedPrem_withComm>*f=pct.));
Untested, obviously, but something along those lines is what you need.
Always check the docs 🙂
(Incurred_Loss__Ledger_='Loss Ratio' *pctsum<ChargedPrem_withComm>*f=pct.));
Untested, obviously, but something along those lines is what you need.
For your variables you could also just use a different LABEL statement.
The var='label' in the body of a table statement is an override meaning that it replaces the default value that would occur. With variable that means a label if defined or the variable name if not.
If you are going to have multiple table statements in the same procedure call and want that change in most places then use the Label statement to move the text out of the table statement an make it easier to read. You could still override per table though.
Similarly the KEYLABEL will let you change the default label of the statistics.
KEYWORD sum='Total ($)'; for instance could be useful if you are summing a lot of currency type variables. You could still override for specific sums in the body of the table definition.
Sometimes it helps to move stuff out of the table definition as debugging code may get messy when you have many labels, formats, style elements and such.
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: