Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • asrol function error

    Hi everyone,

    I am currently trying to calculate cumulative stock returns using the asrol function. I want to generate a variable called 'Momentum' that captures the cumulative returns from t-12 until t-2. I used the following code;

    asrol RET, stat(product) add(1) gen(Momentum) window(dateYM -12 -2) minimum(13) by(PERMNO)

    However, STATA returns the following error;

    missing_Min_noFocal(): 3001 expected 8 arguments but received 9
    asrolfw(): - function returned error
    <istmt>: - function returned error

    When I try calculating the cumulative returns from t-12 until t 0 by using this line of code:

    asrol RET, stat(product) add(1) gen(Momentum) window(dateYM -12) minimum(12) by(PERMNO)

    STATA does not return an error. Can anyone help me with this? I can't figure it out as window() should be able to handle three arguments.

    Thank you in advance,

    Robin Dijl
    Last edited by Robin Dijl; 02 Feb 2023, 08:09.

  • #2
    asrol is a command (not function) from SSC.

    As I understand it your first window is of length 11 from -12 to -2 but you are insisting that each contains 13 values. That is not going to happen.

    Comment


    • #3
      Apologies,

      Changed it to

      asrol RET, stat(product) add(1) gen(Momentum) window(dateYM -12 -2) minimum(11) by(PERMNO)

      but it still returns the following error:

      missing_Min_noFocal(): 3001 expected 8 arguments but received 9
      asrolfw(): - function returned error
      <istmt>: - function returned error

      Comment


      • #4
        That's I think from asrol's internal Mata code, which is compiled, so I think you need Attaullah Shah to comment.

        Comment


        • #5
          The error message suggests that the update may have been unsuccessful. Please try updating again
          Code:
          ssc install asrol, replace
          Regards
          --------------------------------------------------
          Attaullah Shah, PhD.
          Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
          FinTechProfessor.com
          https://asdocx.com
          Check out my asdoc program, which sends outputs to MS Word.
          For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

          Comment

          Working...
          X