BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

Hello

I am using proc summary with proc format.

Why .='Total' is not working?

In the output I want to get  Total row with value 'Total'  but I get it with null value

 

proc format library=work;
value OverLapFmt (multilabel)
low - 60   = 'Until 60'
55 - 70    = '55--70'
65 - high  = '65 and Up'
.='Total'
;
run;
proc summary data=sashelp.class sum ;
   class height / mlf;
   var weight;
   format height OverLapFmt.;
   output out=want sum=sum;
run;

 

 

4 REPLIES 4
Jagadishkatam
Amethyst | Level 16

Please try

 

proc format library=work;
value OverLapFmt (multilabel)
low - 60   = 'Until 60'
55 - 70    = '55--70'
65 - high  = '65 and Up'
Other='Total'
;
run;
Thanks,
Jag
Jagadishkatam
Amethyst | Level 16

Please try the below code, also i removed the mlf option used in proc summary.

 

proc format library=work;
value OverLapFmt (multilabel)
low - 60   = 'Until 60'
55 - 70    = '55--70'
65 - high  = '65 and Up'
Other='Total'
;
run;
proc summary data=sashelp.class sum ;
   class height ;
   var weight;
   format height OverLapFmt.;
   output out=want sum=sum;
run;
Thanks,
Jag
Tom
Super User Tom
Super User

Are you trying to include missing values of the CLASS variable in your analysis?

If so you need add the MISSING option on either the PROC statement or the CLASS statement.

ballardw
Super User

Perhaps this was what you intended:

 

proc format library=work;
value OverLapFmt (multilabel )
low - 60   = 'Until 60'
55 - 70    = '55--70'
65 - high  = '65 and Up'
low-high='Total'
;
run;
proc summary data=sashelp.class sum nway;
   class height / mlf;
   var weight;
   format height OverLapFmt.;
   output out=want sum=sum;
run;

Note that you are going to have a lot of fun trying to get specific order of the formatted values.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 2015 views
  • 1 like
  • 4 in conversation