PROC SQL and round-function

  • Follow


Hi!

I am using PROC SQL to round numbers in a data view, but I have trouble rounding the numbers.

proc sql noprint;
        create view wk1.tmpnrnar as (
                select lm0.nrnar, lm0.status as s, lm0.heldel as h, lm0.kjonn as k,
                antjobb as antjobb, round(avatim,2) as avatim from snaar.lm&aarg. lm0
                where nrnar in ("23152") and &var1. ne .);

I thought round(avatim,2) would give me avatim with 2 decimals, but I only get the number rounded to nearest integer.
What am I doing wrong? Isn't PROC SQL able to round to nearest decimal level?

Regards,
Terje Karlsen
Statistics Norway
0
Reply terje.karlsen (12) 1/16/2004 4:58:03 PM

Terje:

You're rounding to the nearest 2.  Specify round(var,.01) and you'll be much
happier.

From OnlineDocs:

The ROUND function returns a value rounded to the nearest round-off unit. If
round-off-unit is not provided, a default value of 1 is used and argument is
rounded to the nearest integer.


-----Original Message-----
From: Karlsen, Terje [mailto:terje.karlsen@SSB.NO]
Sent: January 16, 2004 11:58 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: PROC SQL and round-function


Hi!

I am using PROC SQL to round numbers in a data view, but I have trouble
rounding the numbers.

proc sql noprint;
        create view wk1.tmpnrnar as (
                select lm0.nrnar, lm0.status as s, lm0.heldel as h,
lm0.kjonn as k,
                antjobb as antjobb, round(avatim,2) as avatim from
snaar.lm&aarg. lm0
                where nrnar in ("23152") and &var1. ne .);

I thought round(avatim,2) would give me avatim with 2 decimals, but I only
get the number rounded to nearest integer.
What am I doing wrong? Isn't PROC SQL able to round to nearest decimal
level?

Regards,
Terje Karlsen
Statistics Norway
0
Reply Harry.Droogendyk (308) 1/16/2004 5:12:07 PM


1 Replies
863 Views

(page loaded in 0.053 seconds)

Similiar Articles:













7/15/2012 1:22:38 AM


Reply: