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

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Always check the docs 🙂

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

3 REPLIES 3
Reeza
Super User

Always check the docs 🙂

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.

 

sikologik
Calcite | Level 5
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!
ballardw
Super User

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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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