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;
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???
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.
> I didn't find the answer
You did. You moved the label right after the column name, where it belongs
ID=''*PCTN='PCT_Customers'
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.