Announcement

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

  • Trouble regarding running xtset, variables do not uniquley identify observations

    I have data which looks like the one attatched below, i have to run a xtest on Year and Industry, post which i plan to run on Xtreg on some of the other varibles. I also converted industries to numbers because the string to numeric converision would not work for me. Now that i run xtset function i get the error varibles do not uniquely identify observations, and upon doing 'isid' i get the same error. If i try to fix this using the duplicate function, it just lists out all the companies and then i cannot drop them so that would not work.
    Would appreciate any help, im a newbie to STATA and have been trying to learn, any help/advice would be appreciated.
    CompanyName Year YEARR Quarter VarMC VarNPID VarNPIDi VarNPIS VarProm compnam VarPE VarPB Var_CR VarDE Var_NPM Var_ROA Industry 0
    20 Microns Ltd. 2009 2009 Q4 659.94 17.55 18.96 50.61 1 10.28 1.57 1.03 2.03 3.39 4.42 Minerals 1
    20 Microns Ltd. 2010 2010 Q4 647.05 20.86 7.42 54.13 1 10.82 1.37 0.75 2.35 2.23 3.02 Minerals 1
    20 Microns Ltd. 2011 2011 Q4 892.11 17.03 58.6 1 11.82 1.74 0.83 2.52 3.68 4.4 Minerals 1
    20 Microns Ltd. 2012 2012 Q4 2484.68 14.55 62.53 1 26.55 3.75 0.8 2.21 0.51 0.55 Minerals 1
    20 Microns Ltd. 2013 2013 Q4 1051.67 14.09 59.68 1 1.39 0.75 2.18 -0.27 -0.28 Minerals 1
    20 Microns Ltd. 2014 2014 Q4 1034.77 17.93 54.2 1 1.41 0.91 2.22 -1.78 -1.8 Minerals 1
    20 Microns Ltd. 2015 2015 Q4 1287.96 19.02 0 51.01 1 46.83 1.58 1 1.85 2.81 Minerals 1
    360 One Wam Ltd. 2009 2009 Q4 2 0.11 0 23.42 18.49 Other fund based financial services 2
    360 One Wam Ltd. 2010 2010 Q4 2 4.14 0 22.08 24.28 Other fund based financial services 2
    360 One Wam Ltd. 2011 2011 Q4 2 1.4 0.37 13.79 12.95 Other fund based financial services 2
    360 One Wam Ltd. 2012 2012 Q4 2 2.05 0 17.73 19.26 Other fund based financial services 2
    360 One Wam Ltd. 2013 2013 Q4 2 1.76 0.29 19.13 23.51 Other fund based financial services 2
    360 One Wam Ltd. 2014 2014 Q4 2 1.19 1.38 26.44 24.6 Other fund based financial services 2
    360 One Wam Ltd. 2015 2015 Q4 2 1.53 0.12 25.65 Other fund based financial services 2
    3I Infotech Ltd. 2009 2009 Q4 14364.31 28.72 35.99 23.61 3 13.16 1.36 0.3 2.3 14.72 4.35 Computer software 3
    3I Infotech Ltd. 2010 2010 Q4 11475.41 31.17 40.36 20.34 3 9.2 1.08 0.57 2.01 11.63 3.35 Computer software 3
    3I Infotech Ltd. 2011 2011 Q4 2236.64 43.01 22.01 20.33 3 2.15 0.22 1.35 2.43 -35.41 -8.16 Computer software 3
    3I Infotech Ltd. 2012 2012 Q4 4709.13 29.01 55.03 7.29 3 0.44 1.29 2.35 -68.22 -9.46 Computer software 3
    3I Infotech Ltd. 2013 2013 Q4 4518.32 33.02 55.34 6.83 3 0.7 0.85 4.82 -83.39 -9.78 Computer software 3
    3I Infotech Ltd. 2014 2014 Q4 5538.85 33.31 53.58 6.66 3 0.71 -204.03 -26.12 Computer software 3
    3I Infotech Ltd. 2015 2015 Q4 3085.5 54.57 33.74 4.8 3 0.53 14.21 -84.27 Computer software 3
    3M India Ltd. 2009 2009 Q4 21017.8 9.64 11.23 76 4 32.63 5.09 2.3 0 7.36 15.12 Plastic furniture, floorings & miscellaneous items 4
    3M India Ltd. 2010 2010 Q4 41020.06 9.73 11.05 76 4 47.96 8.03 2.21 0.02 7.35 13.19 Plastic furniture, floorings & miscellaneous items 4
    3M India Ltd. 2011 2011 Q4 39923.97 9.07 11.63 76 4 51.59 6.88 1.77 0.13 4.16 7.22 Plastic furniture, floorings & miscellaneous items 4
    3M India Ltd. 2012 2012 Q4 45753.65 9.43 11.23 76 4 113.17 7.2 1.27 0.26 2.74 3.94 Plastic furniture, floorings & miscellaneous items 4
    3M India Ltd. 2013 2013 Q4 41117.51 8.88 13.08 75 4 100.36 6.1 1.34 0.17 2.1 2.74 Plastic furniture, floorings & miscellaneous items 4
    3M India Ltd. 2014 2014 Q4 72660.26 8.99 12.77 75 4 83.19 9.48 2.21 0.02 5.61 7.33 Plastic furniture, floorings & miscellaneous items 4
    3M India Ltd. 2015 2015 Q4 128394.2 9.49 12.54 75 4 73.87 13.67 2.52 0.01 8.59 Plastic furniture, floorings & miscellaneous items 4
    3P Land Holdings Ltd. 2009 2009 Q4 310.5 18.07 0.11 68.99 5 16.01 0.74 2.21 1.5 2.4 1.9 Other fund based financial services 2
    3P Land Holdings Ltd. 2010 2010 Q4 427.5 16.64 0.04 68.99 5 1.04 2.68 1.02 -1.58 -1.56 Other fund based financial services 2
    3P Land Holdings Ltd. 2011 2011 Q4 267.3 17.08 0.87 68.99 5 0.67 1.65 1.39 -0.16 -0.2 Other fund based financial services 2
    3P Land Holdings Ltd. 2012 2012 Q4 225 16.83 0.87 72.27 5 28.48 0.56 2.09 1.34 0.48 0.59 Other fund based financial services 2
    3P Land Holdings Ltd. 2013 2013 Q4 126 16.92 0.87 72.27 5 0.31 2.06 1.28 0.47 0.59 Other fund based financial services 2

  • #2
    xtset and duplicates are commands, not functions. In Stata, functions and commands are different entities.

    More crucially for you, assuming that you tried

    Code:
    xtset id date 
    but with a different identifier and (presumably quarterly) data variable, the thing to do is to use the same variables in

    Code:
    duplicates report id date 
    
    duplicates list id date 
    See also https://www.stata.com/support/faqs/d...d-time-values/

    Comment


    • #3
      Hi, when i do the xtset for compnam(company name egen) and year, the data shows to be strongly balanced. So i dont understand why it wont do same with the industries as well?
      Thanks for the help

      Comment


      • #4
        For reference this is how the data looks right now, i need to keep industry and year as fixed effects and I am planning to run -xtreg- on VarPE(y variable) and VarProm VarPB etc (x variable)
        CompanyName Year Quarter VarMC VarNPID VarNPIDi VarNPIS VarProm compnam VarPE VarPB Var_CR VarDE Var_NPM Var_ROA Industry IND
        Grindwell Norton Ltd. 2009 Q4 8154.53 29.34 7.36 58.6 805 13.35 2.23 1.32 0 10.37 11.52 Abrasives 1
        Orient Ceratech Ltd. 2009 Q4 3074.73 34.47 0.05 53.43 1545 6.61 2.01 1.25 0.42 14.9 20.85 Abrasives 1
        Grindwell Norton Ltd. 2010 Q4 13441.41 28.76 7.88 58.63 805 18.18 3.26 2.02 0 9.93 12.68 Abrasives 1
        Orient Ceratech Ltd. 2010 Q4 4438.61 35.34 0.06 53.42 1545 9.8 2.43 1.36 0.5 12.55 6.14 Abrasives 1
        Orient Ceratech Ltd. 2011 Q4 1106.66 29.54 0.05 48.53 1545 9.56 0.56 1.3 0.43 4.67 3.09 Abrasives 1
        Grindwell Norton Ltd. 2011 Q4 12040.8 26.06 11.09 58.63 805 12.65 2.69 1.59 0 10.57 15.65 Abrasives 1
        Grindwell Norton Ltd. 2012 Q4 14864.16 25.88 10.85 58.63 805 14.39 2.78 1.67 0 9.22 12.8 Abrasives 1
        Orient Ceratech Ltd. 2012 Q4 1166.48 37.96 0.03 48.42 1545 21.76 0.81 1.73 0.23 7.78 7.33 Abrasives 1
        Grindwell Norton Ltd. 2013 Q4 14725.76 24.72 11.02 59.03 805 17.6 2.55 1.87 0 8 10.43 Abrasives 1
        Orient Ceratech Ltd. 2013 Q4 2171.45 37.15 2.76 26.53 1545 20.68 1.46 1.94 0.18 3.69 3.45 Abrasives 1
        Orient Ceratech Ltd. 2014 Q4 2673.94 36.36 2.77 25.52 1545 21.02 1.68 1.79 0.18 5.43 5.15 Abrasives 1
        Grindwell Norton Ltd. 2014 Q4 34123.9 21.61 13.09 59.03 805 35.57 5.4 1.89 0 8.28 11.57 Abrasives 1
        Orient Ceratech Ltd. 2015 Q4 6430.61 20.64 7.58 63.06 1545 26.61 3.62 1.89 0.21 8.24 Abrasives 1
        Grindwell Norton Ltd. 2015 Q4 42599.52 19.91 15.48 59.03 805 43.09 6.21 2.02 0 8.23 Abrasives 1
        V S T Tillers Tractors Ltd. 2009 Q4 33.89 5.12 54.86 2291 1.98 0.02 12.13 24.01 Agricultural machinery 2
        Escorts Kubota Ltd. 2009 Q4 12478.68 24.62 31.33 30.1 632 11.9 0.9 0.97 0.19 3.64 3.39 Agricultural machinery 2
        K C K Industries Ltd. 2009 Q4 1107 Agricultural machinery 2
        V S T Tillers Tractors Ltd. 2010 Q4 31.7 6.62 53.91 2291 2.34 0 10.37 20.25 Agricultural machinery 2
        Escorts Kubota Ltd. 2010 Q4 18192.71 19.39 47.16 26.77 632 17.2 1.07 1.09 0.18 3.69 3.56 Agricultural machinery 2
        K C K Industries Ltd. 2010 Q4 1107 Agricultural machinery 2
        K C K Industries Ltd. 2011 Q4 1107 Agricultural machinery 2
        Escorts Kubota Ltd. 2011 Q4 6981.35 27.89 37.28 27.67 632 9.34 0.4 1.04 0.21 2.26 2.37 Agricultural machinery 2
        V S T Tillers Tractors Ltd. 2011 Q4 3533.57 30.88 8.57 53.85 2291 7.54 1.89 2.55 0.08 9.22 17.36 Agricultural machinery 2
        K C K Industries Ltd. 2012 Q4 1107 Agricultural machinery 2
        V S T Tillers Tractors Ltd. 2012 Q4 3378.49 29.16 7.73 53.85 2291 7.12 1.42 3.47 0 9.94 14.61 Agricultural machinery 2
        Escorts Kubota Ltd. 2012 Q4 9064.56 33.64 16.05 41.98 632 10.15 0.57 0.86 0.35 1.68 2.04 Agricultural machinery 2
        Escorts Kubota Ltd. 2013 Q4 16860.45 35.69 11.57 41.97 632 9.12 0.95 1.03 0.24 3.64 6.67 Agricultural machinery 2
        V S T Tillers Tractors Ltd. 2013 Q4 5546.14 30.35 7.8 53.85 2291 7.63 1.84 2.72 0 12.93 20.23 Agricultural machinery 2
        K C K Industries Ltd. 2013 Q4 1107 1.33 0.39 0 Agricultural machinery 2
        Escorts Kubota Ltd. 2014 Q4 15757.26 36.69 12.59 41.96 632 25.28 0.85 0.98 0.27 -0.4 -0.48 Agricultural machinery 2
        K C K Industries Ltd. 2014 Q4 1107 0.6 1.56 0 Agricultural machinery 2
        V S T Tillers Tractors Ltd. 2014 Q4 11927.3 24.84 16.76 53.99 2291 16.04 3.29 4.55 0 11.22 13.28 Agricultural machinery 2
        V S T Tillers Tractors Ltd. 2015 Q4 12465.11 23.43 18.85 53.98 2291 18.62 2.98 5.22 0 10.17 Agricultural machinery 2
        Escorts Kubota Ltd. 2015 Q4 21070.97 38.21 12.22 43.01 632 1.15 0.9 0.2 0.72 Agricultural machinery 2
        K C K Industries Ltd. 2015 Q4 1107 0.88 2.41 0 Agricultural machinery 2
        Global Vectra Helicorp Ltd. 2009 Q4 618.8 17.29 1.54 75 765 5.53 0.4 14.21 -2.17 -0.88 Air transport services 3
        Jet Airways (India) Ltd. 2009 Q4 47790.19 2.94 15.86 80 1076 6.22 0.2 14.21 -5.15 -2.7 Air transport services 3
        Interglobe Aviation Ltd. 2009 Q4 1019 1.72 8.11 19.79 Air transport services 3
        Spicejet Ltd. 2009 Q4 19.64 22.19 12.89 2031 0.37 2.84 7.29 Air transport services 3
        Jet Freight Logistics Ltd. 2009 Q4 1077 Air transport services 3
        Interglobe Aviation Ltd. 2010 Q4 1019 0.88 3.75 14.82 20.17 Air transport services 3
        Jet Freight Logistics Ltd. 2010 Q4 1077 Air transport services 3
        Global Vectra Helicorp Ltd. 2010 Q4 506.1 17.95 3.25 75 765 0.44 -14.02 -5.59 Air transport services 3
        Spicejet Ltd. 2010 Q4 12.21 32.68 38.61 2031 0.15 0.27 2.97 8.37 Air transport services 3
        Jet Airways (India) Ltd. 2010 Q4 66071.42 2.7 15.74 80 1076 117.52 6.87 0.29 14.21 -2.02 -1.35 Air transport services 3
        Jet Airways (India) Ltd. 2011 Q4 14681.1 5.7 11.7 80 1076 0.25 -9.55 -7.38 Air transport services 3
        Interglobe Aviation Ltd. 2011 Q4 1019 0.87 2.7 2.04 3.23 Air transport services 3

        Comment


        • #5
          If each (company, year) combination occurs at most once, xtset in terms of company and year will work. But if any industry includes two or more companies, that will no longer work. On the face of you have many such occurrences, as each (industry, year) combination may occur more than once.

          Comment


          • #6
            Ok thank you, one last thing
            Do you have any advice for this if i want to include Industries as well?

            Comment


            • #7
              I don't have any specific advice on how you should analyse your data.

              Comment

              Working...
              X