BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
art297
Opal | Level 21

Show some sample data with all the calculations in Excel and I'm sure that one of us on the forum can figure out what the difference is.

Costasg
Calcite | Level 5

I am attaching  a sample file. I did the calculations for the first months.

Many thanks

art297
Opal | Level 21

Yes, there were definitely some things that had to be changed in order to match the results.  I think that the following calculates exactly what you were doing in Excel.  The main differences from what I had originally proposed are: (1) using the log10 function rather than the log function; (2) multiplying the differences by 100; and (3) using the corrected rather than the uncorrected sums of squares.

data need;

  set have;

  array vars(*) a1--a100;

  array diff(100);

  yrmon=put(DATE,yymmd.);

  do i=1 to dim(vars);

    diff(i)=(log10(vars(i))-log10(lag(vars(i))))*100;

  end;

run;

proc means data=need mean uss nway noprint;

  var diff1--diff100;

  class yrmon;

  output out=want (drop=_:)

   mean= css= /autoname;

run;

data want;

  set want;

  array diffs(*) diff1_CSS--diff100_CSS;

  do i=1 to dim(diffs);

    if diffs(i) gt 0 then

    diffs(i)=diffs(i)**0.5;

  end;

run;

Costasg
Calcite | Level 5

I don't have words to thank you for your help and time. I will check it in a few days that I will return to the uni but I am sure it is correct.

Many thanks again

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 18 replies
  • 8526 views
  • 6 likes
  • 2 in conversation