## How to convert the format of the numbers in SAS results

Solved
Regular Contributor
Posts: 189

# How to convert the format of the numbers in SAS results

HI ,

I am working with a dataset with roughly 87 million cases (87,195,470 to be exact).

And the SAS output that is generated is showing some of the numbers in a different format.

For instance; as below;

Any suggestions how I can get SAS to show we whole numbers or how to manually convert these results to get a correct whole number?Any help would be greatly appreciated.

Best,

Ashwini

1
 2.155e+08 50.52 97.67 51.59
 5.1421e+06 1.21 2.33 58.34
 2.206E8 51.72
2
 4.566e+07 10.71 98.07 10.93
 899689 0.21 1.93 10.21
 4.656E7 10.92
3
 4.192e+07 9.83 98.71 10.04
 545909 0.13 1.29 6.19
 4.247E7 9.96
4
 8.32796e+06 1.95 97.97 1.99
 172916 0.04 2.03 1.96
 8500874 1.99
5
 1.277e+07 2.99 98.33 3.06
 217178 0.05 1.67 2.46
 1.299E7 3.05
6
 9.354e+07 21.93 98.07 22.39
 1.83684e+06 0.43 1.93 20.84
 9.537E7 22.36
Total
 4.177e+08 97.93
 8.81463e+06 2.07
 4.265e+08 100
Frequency Missing = 451436.57331

Accepted Solutions
Solution
‎01-20-2015 02:20 PM
SAS Super FREQ
Posts: 9,373

## Re: How to convert the format of the numbers in SAS results

Hi:

PROC FREQ directly supports the FORMAT= option in the TABLE statement, too: So a Table Template might not be needed.

cynthia

All Replies
Super User
Posts: 13,583

## Re: How to convert the format of the numbers in SAS results

What procedure is generating the output? A specific example of the code used or generated would be helpful.

One approach would be to use a modified table template with a different default format.

Another would be to direct the output to a dataset and use proc print or another display procedure and assign a different format to allow for large values using a best16. format perhaps.

Regular Contributor
Posts: 189

## Re: How to convert the format of the numbers in SAS results

Below is the code and all numbers inthe output should be weighted numbers..

proc freq data= library.nis0111ARFall;

tables amonth season female racecat income hosp_region hosp_location hosp_teach year died)/ missing;

weight discwt;

run;

Super User
Posts: 13,583

## Re: How to convert the format of the numbers in SAS results

The below code temporarily modifies the basic format of the frequency column used in proc freq with a small example date set.

proc template;
define column Base.Freq.Frequency;
notes "Parent for FREQ Frequency columns";
format = BEST16.;
just = c;
end;
run;

data junk;
input var wt;
datalines;
1 123456789
2 3453453453
;
run;

proc freq data=junk;
table var;
weight wt;
run;

/* This resets back to default*/

proc template;
delete Base.Freq.Frequency;
end;

Solution
‎01-20-2015 02:20 PM
SAS Super FREQ
Posts: 9,373

## Re: How to convert the format of the numbers in SAS results

Hi:

PROC FREQ directly supports the FORMAT= option in the TABLE statement, too: So a Table Template might not be needed.

cynthia

Super User
Posts: 13,583

## Re: How to convert the format of the numbers in SAS results

I haven't access to 9.4 yet so that's my quickest solution for a specific issue. Something else to look forward too when I can get our support staff to get us up to speed.

Regular Contributor
Posts: 189

## Re: How to convert the format of the numbers in SAS results

Thanks very much Cynthia for your timely response! It was helpful and it worked!

It worked for the cross tables using Proc freq. However it didn't work for the proc freq for plain frequncies. Any idea what the reason may be? Is there any way I can get the whole numbers in the plain frequencies (no cross tables). Thanks again!

Here are my codes:

proc freq data= library.nis0111ARFall; Didn't work for this.

tables amonth season female racecat income hosp_region hosp_location hosp_teach year died/ missing format= BEST16.;

weight discwt;

run;

*Bivariate*/;

proc freq data= library.nis0111ARFall; Worked for this one

tables female*died hosp_region*died  hosp_location*died hosp_teach*died  racecat*died  racenew*died income*died

hosp_region * year/ chisq format=BEST16.;

weight discwt;

run;

Regular Contributor
Posts: 189

## Re: How to convert the format of the numbers in SAS results

@ Ballardw: thanks for your elaborate response! Appreciate it! But me being just a intermidiate level programmer, it was difficult for me to follow this.

I use SAS mostly to do stats so not much aware of most formatting/programming aspects of SAS procs.

Super User
Posts: 13,583

## Re: How to convert the format of the numbers in SAS results

Basically, run the proc template define code provided.

After you're done run the proc template delete, unless you want that behavior to be the new default for all proc freq output.

🔒 This topic is solved and locked.