BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

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
Meteorite | Level 14

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' 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 4152 views
  • 0 likes
  • 3 in conversation