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 |
|
|
| ||||||||||||
3 |
|
|
| ||||||||||||
4 |
|
|
| ||||||||||||
5 |
|
|
| ||||||||||||
6 |
|
|
| ||||||||||||
Total |
|
|
| ||||||||||||
Frequency Missing = 451436.57331 |
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
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.
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;
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;
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
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.
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;
@ 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.
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.