10-07-2017 06:52 AM
The correct answer might depend on the details of what you're doing which you haven't told us. As a generic answer: Try using format BEST32., i.e. in your SQL:
max(<variable>) as max_var format=best32. ,
10-09-2017 11:15 AM
You can specify the format to attach to a variable you are deriving in SQL code by adding the FORMAT= keyword.
data have ; num=5E13 ; format num 17.2 ; run; proc sql ; create table want as select max(num) as unformatted , max(num) as formatted format=17.2 from have ; quit; proc print data=want; run;
Obs unformatted formatted 1 5E13 50000000000000.00
10-09-2017 11:44 AM
PROC SQL will not assign formats to derived variables. It really cannot tell the difference between a function like MAX() that does not change the type or range of values and an operation like DATEPART() that could change the meaning of the numbers or SUM() that could change the range of values and hence require a different width for format.
SAS will normally using BEST12. format to display numbers that do not have a format specification.