Announcement

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

  • Using ascol command to calculate weekly returns using CRSP daily returns

    I tried to convert daily stock returns to weekly returns for panel data with firm, date, and returns (simple) for each observation. I tried using the ascol command with the following syntax:
    ascol RET , toweek time(date) panel(permno) returns(simple) keep(all)

    date is the date of the daily return in CRSP, and permno is the firm identifier on CRSP.
    Stata always returns an error code of 3301:
    PRODUCT(): 3301 subscript invalid
    asrolnw(): - function returned error
    <istmt>: - function returned error
    The sample consists of about 20,000 firms and 32 years.
    Does anyone know what the error code implies here? How should I fix my syntax to make it work? Thank you!


  • #2
    Hello Jiaxi Liu
    Please send a sample of your data (or some dummy data) that can reproduce the error to my dropbox email attashah15@hotmail.com. I shall come up with a solution this problem.
    Regards
    --------------------------------------------------
    Attaullah Shah, PhD.
    Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
    www.FinTechProfessor.com
    Check my asdoc program, or even better asdocx, that easily sends Stata output to MS Word

    Comment


    • #3
      Hi Professor Shah,
      Thank you so much for your reply. I will send you a copy of my sample data. Thank you so much for any insights and for your help!
      Regards,
      Jiaxin

      Comment


      • #4
        Thanks for sending me the dataset. In your dataset, I noticed that there are extended missing values, denoted by .b, that was the source of the error. Once replaced with normal missing values (.), ascol works fine.
        Here is the code:

        Code:
        replace RET = . if RET > .
        ascol RET , toweek time(date) panel(permno) returns(simple) keep(all)
        Regards
        --------------------------------------------------
        Attaullah Shah, PhD.
        Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
        www.FinTechProfessor.com
        Check my asdoc program, or even better asdocx, that easily sends Stata output to MS Word

        Comment


        • #5
          Thank you so much, Dr.Shah! It worked after I replaced the missing values with ".". I did not notice the existence of these missing values in the non-standard form before.
          This was a tremendous help from you on my project. I really appreciate it!

          Comment

          Working...
          X