Hi all,
I have a question. I am using the below code to format the total. By using this I am getting percentages with no decimals. However, I want the N counts to have no decimals but the percentages have two decimals. How can I modify it?
Thank you,
proc tabulate data=alt501_main out=gender_grade;
class gender grade /missing;
table grade (all= 'Total'* format=comma16.) ,
gender *(N*format=comma16. Rowpctn)(all= 'Total'* format=comma16.);
run;
@dustychair wrote:
Hi all,
I have a question. I am using the below code to format the total. By using this I am getting percentages with no decimals. However, I want the N counts to have no decimals but the percentages have two decimals. How can I modify it?
Thank you,
proc tabulate data=alt501_main out=gender_grade;
class gender grade /missing;
table grade (all= 'Total'* format=comma16.) ,
gender *(N*format=comma16. Rowpctn)(all= 'Total'* format=comma16.);
run;
gender *(N*format=comma16. Rowpctn*f=6.2)(all= 'Total'* format=comma16.);
Should work. If you want different behavior for values like 100 or 0 you could create a custom format.
@dustychair wrote:
Hi all,
I have a question. I am using the below code to format the total. By using this I am getting percentages with no decimals. However, I want the N counts to have no decimals but the percentages have two decimals. How can I modify it?
Thank you,
proc tabulate data=alt501_main out=gender_grade;
class gender grade /missing;
table grade (all= 'Total'* format=comma16.) ,
gender *(N*format=comma16. Rowpctn)(all= 'Total'* format=comma16.);
run;
gender *(N*format=comma16. Rowpctn*f=6.2)(all= 'Total'* format=comma16.);
Should work. If you want different behavior for values like 100 or 0 you could create a custom format.
Hello,
Rowpctn*format=comma18.2
I guess your decimals will be .00 as otherwise 2 decimals would have been displayed.
Koen
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →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.