Announcement

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

  • Generating proportions

    I am working with a dataset in wide format with a variable for pain level at baseline (bpi_bl) and pain level at 3 months (bpi_3m). I would like to report the proportion of participants who achieved a 30% or more reduction in pain level from baseline to 3 months. The participant variable is study_id. What is the best way to determine how many had a reduction of 30% or more? Thank you in advance!

  • #2
    By your 50th post, you should know that you need to provide a minimal worked example with code and data.

    So, please give your example data using the dataex command. For us to provide meaningful feedback, you must provide your example data using the dataex command, the real data from an easily importable source (i.e., Github), or the equivalent of a toy example.
    Otherwise, anything we say is simply a waste of time. Note, that I'm not trying to be mean in saying this, I'm saying this because if we can't see your dataset as you do with a minimal worked example, anything we suggest is just guesswork. The reason that I'm emphasizing this is because questions (like this one) likely have a relatively simple fix, but even simple fixes can be wildly overcomplicated without a minimal worked example of a dataset and code that you've tried to accomplish your task.

    So please, provide us with your example data that encapsulates the problem.

    Comment


    • #3
      Code:
      generate byte rdc = (bpi_3m - bpi_bl) / bpi_bl < -0.3 if !mi(bpi_bl, bpi_3m)
      tabulate rdc // , missing

      Comment


      • #4
        Originally posted by Katie Holzer View Post
        . . . 30% or more reduction . . .
        Make that
        Code:
        generate byte rdc = (bpi_3m - bpi_bl) / bpi_bl <= -0.3 if !mi(bpi_bl, bpi_3m)

        Comment


        • #5
          I appreciate your patience and help!

          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input str10 study_id double(bpi_bl bpi_3m)
          "CO-009" 6.25  3.5
          "CO-011"    4    4
          "CO-013" 4.75  4.5
          "CO-014" 4.25    5
          "CO-018"    6  7.5
          end

          Comment


          • #6
            Thank you Joseph. rdc=1 indicates a 30% or more reduction, correct?

            Comment


            • #7
              Yes. I learned recently the 1 is implicit.

              Comment


              • #8
                Thank you!

                Comment

                Working...
                X