Announcement

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

  • #16
    Clyde Schechter I am sorry I realized I should include all the variables in the reshape command but it is still showing me error

    The code I used:
    reshape wide result_@_mos ptgender ptage transplantdate result_dt result_name , i(mrn07) j(follo
    > w_num)

    But it doesnt go through it shows ptage not found or ptgender not found

    But I checked multiple times and these are the names of the variable

    Thanks for all the help I think its something minor but I am not able to figure out what

    Comment


    • #17
      Clyde Schechter So I cant keep the age and gender variables as they are in the table right now?
      When I did what you suggested I get age and gender also like age at 3 mo and gender 3mo and so on

      Comment


      • #18
        Clyde Schechter
        I understand your concern but I have read papers about the similar analysis that we are trying to do and my seniors also want such kind of table. Having done that I really need your help one more time honestly you have been my saviour.

        This is how the data set looks right now. I want mean/avg BP for each patient over the period of followup. Mean bp: (sbp3m + sbp6m +..../n)
        But there are missing observations like a lot for some pts. What is the best way to do that?
        Please please do reply I am stuck here!!

        clear
        input long mrn07 int(sbp3m sbp6m)
        1558 . .
        6394 146 112
        22243 . .
        30490 130 .
        33638 . .
        44044 . .
        52431 . .
        56161 142 .
        71354 120 .
        82315 . 149
        89298 . .
        89790 . .
        90846 . 179
        94139 . .
        136683 . 90
        141293 . .
        143430 142 146
        146924 . .
        167432 . .
        168955 . .
        322305 . .
        322870 . .
        340177 . .
        347074 . .
        357372 121 .
        408326 . .
        409279 . .
        413870 120 129
        426366 . 104
        434822 140 136
        440228 . 140
        444144 . .
        449069 118 102
        451379 . .
        457911 . .
        459979 135 114
        461106 118 .
        490384 148 .
        497844 120 136

        Comment


        • #19
          So basically I want to create a new variable Mean bp for each patient ID but the missing observations I dont know how they affect the results

          Comment


          • #20
            Code:
            egen mean_sbp = rowmean(sbp3m sbp6m)

            Comment


            • #21
              Re #16 & #17

              It makes sense to include age in the -reshape- command. But there is no reason to include gender or transplantdate, because those do not change over time within a patient. Including those in the -reshape- command will just clutter up your data set with redundant variables of gender3mos gender6mos, etc. that all have the same information. Leave those out. Age is different because it will change over time, so it makes sense to track it period by period.

              I cannot troubleshoot your error message about ptage not found and ptgender not found. Whenever you need help with troubleshooting you have to post example data, using the -dataex- command, that reflects the data as it is just before the point where you are encountering difficulty, and then show the exact code that you used, and the exact response you got from Stata. Without that information nobody can really know what went wrong, so nobody can tell you how to fix it. When you don't provide complete information, the only response you can get is a request for more information--which really just postpones the time when your problem gets solved. So help yourself by helping those who help you.

              Comment

              Working...
              X