Announcement

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

  • #16
    I have NIS combined from 2016 to 2020, and the year variables exist; however, I am unable to trend my data by the year prior to 2020. It seems as if the previous years are missing with the YEAR variable. I created a variable by using
    generate YEART=.
    replace YEART =0 if YEAR==.
    replace YEART =1 if YEAR==2016
    replace YEART =2 if YEAR==2017
    replace YEART =3 if YEAR==2018
    replace YEART =4 if YEAR==2019
    replace YEART =5 if YEAR==2020

    then I tried to trend using the tabulate command with the associated disease variable. However I only see one value in my results

    Comment


    • #17
      It was helpful that you showed how you created the YEART variable. But as you show neither example data nor the tabulate command you tried, nor the actual output it gave you (other than providing a vague description of it), it's anybody's guess what actually went wrong.

      Please post back after you read the Forum FAQ for excellent advice on how to maximize your chance of getting a timely and helpful response. Pay particular attention to the advice on how to show example data (-dataex-) and how to show code and results (code delimiters).

      Comment


      • #18
        First, do check that you indeed have the expected values for YEAR in your dataset.

        Code:
        tab YEAR
        If not, abort and go back to fix how you combined your datasets. If this looks fine, you can generate a re-centered year variable using something like below. The following code tries to copy your intent to have the year 2016 take a value of 1 in your new variable.

        Code:
        gen int yeart = YEAR - 2015
        
        * just a check, to make sure you understand that you did what you wanted
        tab YEAR yeart, missing
        This is as far as I can guess with your description, but you should probably start a new thread if you still need help. It is crucial that you use the trend weights supplied by the data provider if you want to make claims about national trends over time.

        Comment


        • #19
          Hi,
          I am trying to startify NIS data based on number of procedures performed per year. Can you please guide which command should I use.
          Thanks

          Comment


          • #20
            Hi,
            I am trying to startify NIS data based on number of procedures performed per year. Can you please guide which command should I use. I would like to strtify data inti 5 quatrtiles 1. <=10 2. >10 & <=25 3. >25 & <=45 4. >45 &<=90 5. >90

            Thanks

            Comment


            • #21
              Originally posted by Jasmeet Kaur View Post
              Hi,
              I am trying to startify NIS data based on number of procedures performed per year. Can you please guide which command should I use. I would like to strtify data inti 5 quatrtiles 1. <=10 2. >10 & <=25 3. >25 & <=45 4. >45 &<=90 5. >90

              Thanks
              Per my other comment, please start a new thread.

              Comment


              • #22
                These bins aren't quartile or quintile bins or quantile bins generally, as that would imply an attempt to subdivide observations into groups with approximately equal numbers.

                Here are some ways to do it.

                Code:
                gen wanted = cond(whatever <= 10, 1, cond(whatever <= 25, 2, cond(whatever <= 45, 3, cond(whatever <= 90, 4, 5)))) if whatever < . 
                
                gen wanted = 5 if whatever > 90 & whatever <
                replace wanted = 4 if whatever > 45 & wanted == .
                replace wanted = 3 if whatever > 25 & wanted == .
                replace wanted = 2 if whatever > 10 & wanted == .
                replace wanted = 1 if whatever <= 10 & wanted == .
                Note. Please run your posts through software with a spelling checker,

                Comment

                Working...
                X