Hello, I am trying to relable my column and name the sum label to total instead of blank in the proc print statement but it doesn't seem to be working. What am I missing?
proc print data=work.Table1_Final noobs sumlabel='Total';
sum P1 P2 P3 P4;
title "TABLE 1: # of Members Filling Opioids";
label p1='7/1/20 - 12/31/2020'
label p2='4/1/20 - 09/30/2020'
label p3='1/1/20 - 06/30/2020'
label p4='10/1/19 - 03/31/2020';
run;
SUMLABEL from the documentation:
SUMLABEL
NOSUMLABEL
SUMLABEL='label'
specifies whether to display a label on the summary line for a BY group.
So without a BY statement has no effect.
You have a couple of options, one would be to add a dummy variable to use as a "by" variable so sum label works.
Another would be to move to Proc Report which has a more robust set of text controls.
Choices can depend on what other variables are in your data and need to be displayed.
I might guess that you manually summarized the data to get your P1 to P4 variables. That could likely be done directly in a report procedure like Proc Report or Tabulate from raw data as long as you have a date variable.
You may need to add the LABEL option in PROC PRINT as well.
proc print data=work.Table1_Final noobs sumlabel='Total' label;
@ssitharath0420 wrote:
Hello, I am trying to relable my column and name the sum label to total instead of blank in the proc print statement but it doesn't seem to be working. What am I missing?
proc print data=work.Table1_Final noobs sumlabel='Total';
sum P1 P2 P3 P4;
title "TABLE 1: # of Members Filling Opioids";
label p1='7/1/20 - 12/31/2020'
label p2='4/1/20 - 09/30/2020'
label p3='1/1/20 - 06/30/2020'
label p4='10/1/19 - 03/31/2020';
run;
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.