Hello SAS Experts,
I have applied format=f12.1; to my proc report column but if there are no decimal places then no formatting happens.
How can I enforce that even if there is no decimal place I can read 100,0 or 90,0 and not just 100 and 90?
@RW9, I know it might be a strange thing to do to make up information on decimals which isnt there but this is an aesthetic requirement by the end user, I cant help it 🙂
Hi:
This is almost acting like the BEST format is being used instead of the format you specified. If you run the attached code, you can see the difference between using a format and using the BEST format (which is what most SAS procedures default to).
You did not post any data or your full code or your destination of interest. Another possibility is that you are opening the output in Excel and Excel is losing the format.
This code correctly shows the 1 decimal place for the values for HEIGHT and WEIGHT and the use of the BEST format shows the decimal place not being used.
So without knowing more about your code and your destination, perhaps this will point you in the right direction.
cynthia
proc report data=sashelp.class nowd;
column name age sex height weight height=htbsfmt weight=wtbsfmt;
define name / order;
define height / f=12.1;
define weight / f=12.1;
define htbsfmt / f=best12.1;
define wtbsfmt /f=best12.1;
run;
Hi:
This is almost acting like the BEST format is being used instead of the format you specified. If you run the attached code, you can see the difference between using a format and using the BEST format (which is what most SAS procedures default to).
You did not post any data or your full code or your destination of interest. Another possibility is that you are opening the output in Excel and Excel is losing the format.
This code correctly shows the 1 decimal place for the values for HEIGHT and WEIGHT and the use of the BEST format shows the decimal place not being used.
So without knowing more about your code and your destination, perhaps this will point you in the right direction.
cynthia
proc report data=sashelp.class nowd;
column name age sex height weight height=htbsfmt weight=wtbsfmt;
define name / order;
define height / f=12.1;
define weight / f=12.1;
define htbsfmt / f=best12.1;
define wtbsfmt /f=best12.1;
run;
Hi Cynthia,
Thanks for your reply! Indeed, it is MS Excel cutting off the 0 😕
The format=nlnum32.2; format worked, MS Excel did not cut off the zero's.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.