Announcement

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

  • by permno : egen cnt = count(permno), drop if ctn< 24 or ctn <=24 is not keeping series which have no missing values in 24 month, what to do

    Hi all,

    I found this command by permno : egen cnt = count(permno), drop if ctn< 24 or ctn <=24 in some university slides, and according to the slides it should keep only the series which have no missing observations in those months but it is not, I also wonder how it should since the date is not sorted
    any suggestions

  • #2
    That counts how many times the variable permno is itself not missing. Perhaps you want to check whether some other variable(s) is not missing.

    Comment


    • #3
      So I could sort on returns and count if they are missing and delete if cnt<=24 so I have consecute returns data for 24 months at least? I'll try that, thanks

      Comment


      • #4
        Well I typed in by permno : egen cnt = count(return) but this does not give me a sequence, so from when to when the retun is missing, when I use tsspell I get sequences, but I can't just type drop if tsspell<24, since there are also some with a sequence grater than 24 and those I don't want to touch/change, so how could I use tsspell to delete only the onse which have not a fullsequence of 24 returns without deleting a part of the others which have full sequences?

        Comment


        • #5
          Sounds right. Note that sorting is not necessary if you are just counting.

          Comment


          • #6
            well I now sequences which start again if there is a missing value, but I would like to delete drop if sequence <= 24 but not >24, but as I see it in the data browser I have e.g permno1 1, permno1 2, but I don"t know how I could tell stat to delete only the values where the sequence is less 24 but not 25 or 26, I mean there are sequences that go from 1 to 25 and those I need completely, how to type that in?

            Comment


            • #7
              Sorry, but you lost me.

              Comment


              • #8
                actually I need something like keep if sequence > then range from 1 to 24, how would a proper command look like to accomplish this

                Comment


                • #9
                  well permno : egen cnt = count(return) gave me just the number or count of returns, not of consecutive returns, I want to delete sequences of 24 months if at any point in a 24 sequence a values is missing, and that for every panel (permno), I hope it is clearer now?

                  Comment

                  Working...
                  X