Announcement

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

  • #16
    Originally posted by Clyde Schechter View Post
    The link to a picture in your last post does not connect, at least not for me. In any case, picture attachments on this forum usually are difficult to read, at best. The best way to show us what you typed and what Stata gave you, is to copy both the command and the ouput from the Results window and paste it into a code block in the Forum's advanced editor. It always comes out readable that way.

    In any case, I'm coming very late to this particular party. But just perusing the recent posts, it appears that you created a variable using the following code:
    Code:
    gen GRB = GradeRepeat >=1
    but you want GRB to be missing if GradeRepeat is missing. So that code is incorrect for that purpose. As was explained earlier by others, Stata represents missing values of numeric variables internally by numbers that are larger than all non-missing numerical values. So any missing value of GradeRepeat will satisfy the condition GradeRepeat >= 1, and the corresponding value of GRB will be 1, not missing. So you need to change the code to:
    Code:
    gen GRB = GradeRepeat >= 1 if !missing(GradeRepeat)
    The use of the -if- qualifier will cause Stata to leave GRB missing when GradeRepeat is missing. If you run that and then tab -GRB GradeRepeat, miss-, you will see that it all comes out the way you want.

    Perfect!

    Code:
    . tab GradeRepeat GRB1
    
    GradeRepea |         GRB1
             t |         0          1 |     Total
    -----------+----------------------+----------
             0 |     4,753          0 |     4,753 
             1 |         0        976 |       976 
             2 |         0        183 |       183 
             3 |         0         29 |        29 
             4 |         0          2 |         2 
    -----------+----------------------+----------
         Total |     4,753      1,190 |     5,943 
    
    
    . tab GradeRepeat GRB1, miss
    
    GradeRepea |               GRB1
             t |         0          1          . |     Total
    -----------+---------------------------------+----------
             0 |     4,753          0          0 |     4,753 
             1 |         0        976          0 |       976 
             2 |         0        183          0 |       183 
             3 |         0         29          0 |        29 
             4 |         0          2          0 |         2 
             . |         0          0      3,041 |     3,041 
    -----------+---------------------------------+----------
         Total |     4,753      1,190      3,041 |     8,984
    Apologies for my layout and explanation, I have had a scarce few hours of experience with the program in which the worksheets provided does not satisfy some of the questions I have.


    Thank you to everyone that has contributed.

    Comment

    Working...
    X