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

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.155E8
50.52
97.67
51.59
5142105
1.21
2.33
58.34
2.206E8
51.72
2
4.566E7
10.71
98.07
10.93
899689
0.21
1.93
10.21
4.656E7
10.92
3
4.192E7
9.83
98.71
10.04
545909
0.13
1.29
6.19
4.247E7
9.96
4
8327958
1.95
97.97
1.99
172916
0.04
2.03
1.96
8500874
1.99
5
1.277E7
2.99
98.33
3.06
217178
0.05
1.67
2.46
1.299E7
3.05
6
9.354E7
21.93
98.07
22.39
1836836
0.43
1.93
20.84
9.537E7
22.36
Total
4.177E8
97.93
8814633
2.07
4.265E8
100.00
Frequency Missing = 451436.57331
1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

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

Base SAS(R) 9.4 Procedures Guide: Statistical Procedures, Second Edition

cynthia

View solution in original post

8 REPLIES 8
ballardw
Super User

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.

Ashwini_uci
Obsidian | Level 7

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;

ballardw
Super User

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

ods path sasuser.templat(update) sashelp.tmplmst(read);

proc template;                                                               
   define column Base.Freq.Frequency;                                        
      notes "Parent for FREQ Frequency columns";                             
      header = "Frequency";                                                  
      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;

Cynthia_sas
SAS Super FREQ

Hi:

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

Base SAS(R) 9.4 Procedures Guide: Statistical Procedures, Second Edition

cynthia

ballardw
Super User

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.

Ashwini_uci
Obsidian | Level 7

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;

Ashwini_uci
Obsidian | Level 7

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

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

ballardw
Super User

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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 3176 views
  • 4 likes
  • 3 in conversation