PROC TABULATE: Labeling my column

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

PROC TABULATE: Labeling my column

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:

 sastab.JPG

 

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?


Accepted Solutions
Solution
a month ago
Super User
Posts: 21,546

Re: PROC TABULATE: Labeling my column

Posted in reply to sikologik

Always check the docs Smiley Happy

http://documentation.sas.com/?docsetId=proc&docsetVersion=9.4&docsetTarget=p0nug0r42bnz2cn1k9n16siq2...

 

(Incurred_Loss__Ledger_='Loss Ratio' *pctsum<ChargedPrem_withComm>*f=pct.));

Untested, obviously, but something along those lines is what you need.

 

View solution in original post


All Replies
Solution
a month ago
Super User
Posts: 21,546

Re: PROC TABULATE: Labeling my column

Posted in reply to sikologik

Always check the docs Smiley Happy

http://documentation.sas.com/?docsetId=proc&docsetVersion=9.4&docsetTarget=p0nug0r42bnz2cn1k9n16siq2...

 

(Incurred_Loss__Ledger_='Loss Ratio' *pctsum<ChargedPrem_withComm>*f=pct.));

Untested, obviously, but something along those lines is what you need.

 

New Contributor
Posts: 2

Re: PROC TABULATE: Labeling my column

Thanks Reeza. As it turns out, I was using that particular documentation along with a few other things I got out of google to get *almost* all the way home. 99% of the way there. Your code snippet got me the final 1% and now I have everything I need- thanks!
Super User
Posts: 12,148

Re: PROC TABULATE: Labeling my column

Posted in reply to sikologik

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.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 117 views
  • 1 like
  • 3 in conversation