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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 18 replies
  • 8702 views
  • 6 likes
  • 2 in conversation