Hi: Your FORMAT statement is being ignored by PROC FREQ -- so that is a non-issue. The only way to alter a format with PROC FREQ is to change the TABLE template. (23349 - Modify the default format displayed with PROC FREQ) You can prove this to yourself, that the format is being ignored. Here's Chevrolet both with and without the format...same results. Next, if I go out 5 decimal places (with TABULATE) and "add up" the individual numbers on my calculator, I get 100.00001; however, as Tom pointed out, SAS does not "add up" the percent numbers. Never. The formula for calculating a percent is 100*number in cell divided by denominator = percent -- so as he said: 100*7 / 27 = 25.92593 and the "grand total" of 27 is calculated internally as 100*27 / 27 which will always be 100 -- your "individual cell percents" are not "added up" by SAS. So, your 27 cars are not 99.99 percent of the total, the 27 cars are 100% of the total, no matter what the "individual percents" add up to. Here's some code comparing FREQ and TABULATE and showing the same individual percents and the same grand total percent. Note that 25.92593 IS rounded by TABULATE to 25.93. However, 100*13 / 27 = 48.148148148, which SAS is rounding to 48.1 -- if you want some definitive answer on the rounding algorithm and why that number got rounded to 48.1, by both FREQ and TABULATE instead of 48.2, you'd have to open a track with Tech Support. To me it is a moot point, since the 27 total cars are 100% and not 99.99%. cynthia proc sort data=sashelp.cars out=cars; by make; where make in ('Chevrolet'); run; proc freq data=cars; title '1) PROC FREQ without fmt statement'; by make; tables cylinders; run; proc freq data=cars; title '2) PROC FREQ with fmt statement'; format percent commax10.1; by make; tables cylinders; run; proc tabulate data=cars; title '3) PROC TABULATE default fmt'; by make; class cylinders; table cylinders all, n pctn; run; proc tabulate data=cars; title '4) PROC TABULATE 10.1 fmt'; by make; class cylinders; table cylinders all, n*f=commax10. pctn*f=commax10.1; run; proc tabulate data=cars; title '5) PROC TABULATE diff format 5 dec places'; by make; class cylinders; table cylinders all, n*f=commax10. pctn*f=commax14.5; run;
... View more