BookmarkSubscribeRSS Feed
hellind
Quartz | Level 8

I can view variable UTIL as 0. Before this, I use UTIL=round(a/b,0.0001) to calculate UTIL.

And then I use proc expand as below:

PROC EXPAND data=trade_util out=trade_util1;

  ID misdate;

  BY customer;

  CONVERT util=util_MEAN3  / transformout=(movave 3 lag 1);

RUN;

Do anyone know why for moving average of 3 zeros, I get numbers like

-8.67362E-18

-3.1984E-18

-8.2038E-18

-3.79471E-18

-9.1073E-18

I follow it up with code like this, but how can I avoid this extra step? It has something to do with numeric precision.

data work.trade_util1;

set work.trade_util1;

util_MEAN3=max(0,util_MEAN3);

run;

3 REPLIES 3
hellind
Quartz | Level 8

Would anyone know the reason for the mov average mean to be such small numbers?

Ksharp
Super User

Not sure if it could work. Make UTIL be a small length .

length UTIL 3 ;

and why not use INT() ?

Xia Keshan

PGStats
Opal | Level 21

I thing proc expand is geared for speed and skips the numerical precautions that are common in other procedures. You will have to follow the procedure call with a datastep to round() or fuzz() output values. If only for display, numerical formats will do the rounding for you.

PG

PG

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1036 views
  • 0 likes
  • 3 in conversation