☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Obsidian | Level 7

Reporting large numbers

I have a very large number in a frequency table which SAS is abbreviating in the output as below. How can i get SAS to report all the digits?

`` ``

1 ACCEPTED SOLUTION

Accepted Solutions
Quartz | Level 8

Re: Reporting large numbers

Hi @bayzid , You need to mention format after forward "table vars / "

`format=comma14. `

Refer this simple example where I've created 1B rows with same value (A++). It means when I run proc freq without any format, I'll also get the same value in hexadecimal format.

``````/* create a new dataset with 1B rows*/
data OneBillionRows (keep=rank);
do i=1 to 1000000000;
rank='A++';
output;
end;
run;
``````

PROC FREQ without Format:

``````proc freq data=OneBillionRows;
tables Rank*Rank / list all  ;
run;``````

Output:

PROC FREQ with FORMAT

``````proc freq data=OneBillionRows;
tables Rank*Rank / list all  format=comma14. ;
run;``````

Output:

BI Developer. Writer. Creative Educator.

SAS Blog → https://learnsascode.com
9 REPLIES 9
Diamond | Level 26

Re: Reporting large numbers

And hint hint hint for next time, I think you will get faster answers if you do a simple search first. I found that via a simple internet search for:

How to change formats in PROC FREQ

which took me less time than it takes to write a post here.

--
Paige Miller
Quartz | Level 8

Re: Reporting large numbers

Hi @bayzid , You need to mention format after forward "table vars / "

`format=comma14. `

Refer this simple example where I've created 1B rows with same value (A++). It means when I run proc freq without any format, I'll also get the same value in hexadecimal format.

``````/* create a new dataset with 1B rows*/
data OneBillionRows (keep=rank);
do i=1 to 1000000000;
rank='A++';
output;
end;
run;
``````

PROC FREQ without Format:

``````proc freq data=OneBillionRows;
tables Rank*Rank / list all  ;
run;``````

Output:

PROC FREQ with FORMAT

``````proc freq data=OneBillionRows;
tables Rank*Rank / list all  format=comma14. ;
run;``````

Output:

BI Developer. Writer. Creative Educator.

SAS Blog → https://learnsascode.com
Obsidian | Level 7

Re: Reporting large numbers

Thanks very much.

Obsidian | Level 7

Re: Reporting large numbers

I am using the following code but still the same result.
proc freq data=sas.dosemed_all; tables ScheduleType/list all format=comma14.; run;

Super User

SAS Employee

Re: Reporting large numbers

To format frequencies in a one-way frequency table, you can use the ONEWAY(FORMAT=) option in the TABLES statement.

```proc freq data=sas.dosemed_all;
tables ScheduleType / oneway(format=comma14.);
run;```
Obsidian | Level 7

Re: Reporting large numbers

``````14799  proc freq data=sas.dosemed_all;
14800      tables ScheduleType / oneway(format=comma14.);
------                -
22                    22
202                   200
ERROR 22-322: Syntax error, expecting one of the following: ;, AGREE, ALL, ALPHA, BDT, BIN,
BINOMIAL, CELLCHI2, CHISQ, CL, CMH, CMH1, CMH2, COMMONRISKDIFF, COMONMRDIFF,
CONTENTS, CONVERGE, CROSSLIST, CUMCOL, DEVIATION, EXACT, EXPECTED, FISHER,
FORMAT, GAILSIMON, GS, JT, KAPPA, LINE, LIST, MAXITER, MAXLEVELS, MEASURES,
MISSING, MISSPRINT, NOCOL, NOCUM, NOFREQ, NOPERCENT, NOPRINT, NOROW, NOSPARSE,
NOWARN, ODDSRATIO, OR, OUT, OUTCUM, OUTEXPECT, OUTPCT, PEARSONRES, PEARSONRESID,
PLCORR, PLOTS, PRINTKWTS, PRINTWTS, RELRISK, RISKDIFF, SCORE, SCORES, SCOROUT,
SENSPEC, SPARSE, STDRES, STDRESID, TABLE, TESTF, TESTP, TOTPCT, TREND, WARN.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
ERROR 200-322: The symbol is not recognized and will be ignored.
14801  run;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE FREQ used (Total process time):
real time           0.03 seconds
cpu time            0.01 seconds``````
SAS Employee

Re: Reporting large numbers

The ONEWAY(FORMAT=) option is available in PROC FREQ beginning in release 2020.1 (Viya 4).

Alternatively, you can change the format of frequencies in one-way tables by modifying the template. There's an example in Usage Note 37442: Modifying the OneWayFreqs template

Quartz | Level 8

Re: Reporting large numbers

As explained by @Watts, Base.Freq.OneWayFreqs can solve this formatting problem.

Here is the same example adjusted according to what you're looking for! @bayzid

``````ods path reset;
ods path (prepend) work.templat(update);
ods path show;

proc template;
edit Base.Freq.OneWayFreqs; column Line FVariable FListVariable Variable Frequency
TestFrequency Percent TestPercent CumFrequency CumPercent;
edit frequency;
format=comma14.;
end;
edit percent;
format=8.3;
end;
end;
run;
proc freq data=OneBillionRows;
tables Rank / list all nocum  ;
run;

proc template;
delete Base.Freq.OneWayFreqs;
run;``````