BookmarkSubscribeRSS Feed
JET_PANGAN
Fluorite | Level 6

Hi,

 

Using the PROC Tabulate, I'm trying to format the field in the VAR statement using the values in CLASSLEV variable. Unfortunately, it does not work. The format in the VAR statement is dependent on the values in the CLASS variables.

 

Any help is appreciated. Thanks.

 

3 REPLIES 3
andreas_lds
Jade | Level 19

Please post code and log in the windows appearing when using {i}- or running-man-icon. Test-data, posted as data-step using datalines statement, is useful, too.

JET_PANGAN
Fluorite | Level 6

I'm experimenting if the code below works. I attached the sample data.

 

/* START OF SAS CODE */

proc format;
value measure_fmt
1 = comma32.
OTHER = comma32.2
;
run;

proc tabulate data=WORK.sample_data;
class F1 F2 F3 F4 SEQ_NO;
classlev F4 / style={Format=measure_fmt.};
var NOACCT;
table
/* Row Labels */
SEQ_NO,
/* Column Labels */
F1=" "*F2=" "*F3=" "*F4={LABEL=" "}*NOACCT=" "*SUM=" "*{STYLE=<PARENT>};
RUN;

/* END OF SAS CODE */

andreas_lds
Jade | Level 19

SAS-Formats are applied by using the format-statement, not the style option.

So adding

format F4 measure_fmt.;

should solve the issue.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1050 views
  • 0 likes
  • 2 in conversation