Help using Base SAS procedures

Decimals

Reply
Contributor
Posts: 73

Decimals

Morning!

I have a number 41.2 and i want it to show as 41 removing everything after the decimal, can anyone help?

Thanks

Fred
Trusted Advisor
Posts: 2,115

Re: Decimals

If you want to actually remove the decimal part, then the function to use is FLOOR. If you just want to display it without a decimal, then just use a format, like
FORMAT myvar 3.;
Contributor
Posts: 73

Re: Decimals

Hi Duke

Sorry for my lack of knowledge, how can i incorporate the FLOOR into the below code?

Fred

proc sql;
create table TVStats as
select
mean(TvAverage_Speed_of_Answer__Sec_) as Tv_AvgSpeedofAnswerSec
FROM Cscore.tv;
quit;
Super Contributor
Posts: 358

Re: Decimals

Hi All:

Not to go off-topic, but I have a similar question. How do I get just the mantissa of the floating-point number - other than subtracting the figure from its' integer? I could have sworn that there was a function (like the opposite of int() ) that would do it.
Trusted Advisor
Posts: 2,115

Re: Decimals

FredBell: Just add the floor to the Mean line
FLOOR(mean(TvAverage_Speed_of_Answer__Sec_)) as Tv_AvgSpeedofAnswerSec

OS2 Rules: please start a new thread.
Contributor
Posts: 73

Re: Decimals

Thanks for your help Duke.

Fred
Ask a Question
Discussion stats
  • 5 replies
  • 172 views
  • 0 likes
  • 3 in conversation