Hi SAS Experts,
I looked at the round function explanation and read that a ,1 should result in no decimals but my calculation reads 100,0 now and not just 100.
proc sql ;
CREATE TABLE mytable AS
SELECT
ROUND((SUM(numberA)*100)/SUM(numberB),1) AS percent_ab
FROM aaaa;
QUIT;
Well it's rounded but you're looking to control the display.
proc sql ;
CREATE TABLE mytable AS
SELECT
ROUND((SUM(numberA)*100)/SUM(numberB),1) AS percent_ab format=8.
FROM aaaa;
QUIT;
Not quite sure exactly what you mean by "calculation reads 100,0"
Round is applied AFTER the results of
(SUM(numberA)*100)/SUM(numberB)
The FORMAT of the varaible percent_ab could be forcing the appearance of decimals. If the format is something like 5.1 it will force the appearance of 1 decimal, showing a 0 when none are actually present.
Well it's rounded but you're looking to control the display.
proc sql ;
CREATE TABLE mytable AS
SELECT
ROUND((SUM(numberA)*100)/SUM(numberB),1) AS percent_ab format=8.
FROM aaaa;
QUIT;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.