BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

I am using proc tabulate.

I want to format the summary columns and also  rename columns.

proc format;
value multiFmt (multilabel notsorted)
2,3='2-3'
4='4'
2-4='Total 2-4'
5-8='5-8'
9-10='9-10'
5-10='Total 5-10'
11='11'
low-high='Total All'
;
Run;

PROC TABULATE DATA=ttbl  OUT=output;
class group / mlf preloadfmt order=data ;
	VAR ID Y  ;
	TABLE group='' ,
                      ID=''*(N*f=6.0)='No_Customers' 
		      ID=''*(PCTN*f=6.1)='PCT_Customers'
                      Y=''*(sum*f=6.0)='sum_Y'
                      Y=''*(PCTsum*f=6.1)=='PCT_sum_Y'
;
format group multiFmt.;
RUN;

Please find the log error

29 TABLE group='' ,
30 ID=''*(N*f=6.0)='No_Customers'
_
22
31 ID=''*(PCTN*f=6.1)='PCT_Customers'
_
22
32 Y=''*(sum*f=6.0)='sum_Y'
_
22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string.
33 Y=''*(PCTsum*f=6.1)=='PCT_sum_Y'
_
22
200
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, (, *, ',', /, [, _ALL_, _CHARACTER_,
_CHAR_, _NUMERIC_, {.
ERROR 200-322: The symbol is not recognized and will be ignored.
34 ;
35 format group multiFmt.;
36 RUN;

4 REPLIES 4
Ronein
Onyx | Level 15

No, I just showed the log.

I didn't find the answer and this is the reason that I have posted the question.

Don't you think so???

 

ballardw
Super User

If you are going to relabel a variable or statistic then that goes immediately after the name or statistic.

Not:

ID=''*(N*f=6.0)='No_Customers' 

but

ID=''*(N='No_Customers' *f=6.0) 

You may also want the table option ROW=FLOAT to clean up the suppressed blank labels in the row headers.

ChrisNZ
Tourmaline | Level 20

> I didn't find the answer

You did. You moved the label right after the column name, where it belongs

ID=''*PCTN='PCT_Customers' 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 4 replies
  • 5391 views
  • 0 likes
  • 3 in conversation