Announcement

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

  • Generate difference variable between 2 digits sectors and relevant 3 digits sub-sectors of NACE Rev.2

    Dear all,

    I have a data set consisting of Inflation rates relating to 2-,and 3- digit sectors of Nace Rev.2 (EU statistical classification of economic activities) within 2009-2015. I want to calculate the difference of inflation rate between an 3-digit sector and the relevant 2-digit sector, for each year. For example, the rate is 15.31 for the sector coded as "05" in 2009 and 17.32 for the sector coded as "051". Which I want to calculate is 17.32-15.31=2.01 . Unfortunately I could not get the right result in time series. The example is shown below. Thank you, in advance.

    Demet

    input str21 nace2 int year double INF
    "05" 2009 15.318812147951045
    "05" 2010 2.3101129502128344
    "05" 2011 10.09227343766727
    "05" 2012 13.211662744945482
    "05" 2013 8.472921634922345
    "05" 2014 3.4376096933995313
    "05" 2015 7.340746373002781
    "051" 2009 17.325343317663688
    "051" 2010 -4.096954738327096
    "051" 2011 29.639948867807398
    "051" 2012 3.8411925209451825
    "051" 2013 -1.6302665737451885
    "051" 2014 5.844695104984924
    "051" 2015 -8.030866481839862
    "052" 2009 13.765451678185132
    "052" 2010 2.9714595375722848
    "052" 2011 8.045823592896115
    "052" 2012 14.002491873175646
    "052" 2013 9.428377704779981
    "052" 2014 3.203318187219548
    "052" 2015 8.666604526712861
    "06" 2009 -19.937099786950878
    "06" 2010 32.874797814533494
    "06" 2011 48.957582455185715
    "06" 2012 15.666366645702853
    "06" 2013 2.7049818159322867
    "06" 2014 8.010905229120812
    "06" 2015 -34.49525263049765
    "061" 2009 -26.047959050125797
    "061" 2010 38.23646238491703
    "061" 2011 55.66262112444452
    "061" 2012 14.310674749749127
    "061" 2013 1.3745259428381438
    "061" 2014 8.686079467044364

  • #2
    Sorry, for the missing dataex command. It should be like the one below:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str21 nace2 int year double INF
    "05"  2009  15.318812147951045
    "05"  2010  2.3101129502128344
    "05"  2011   10.09227343766727
    "05"  2012  13.211662744945482
    "05"  2013   8.472921634922345
    "05"  2014  3.4376096933995313
    "05"  2015   7.340746373002781
    "051" 2009  17.325343317663688
    "051" 2010  -4.096954738327096
    "051" 2011  29.639948867807398
    "051" 2012  3.8411925209451825
    "051" 2013 -1.6302665737451885
    "051" 2014   5.844695104984924
    "051" 2015  -8.030866481839862
    "052" 2009  13.765451678185132
    "052" 2010  2.9714595375722848
    "052" 2011   8.045823592896115
    "052" 2012  14.002491873175646
    "052" 2013   9.428377704779981
    "052" 2014   3.203318187219548
    "052" 2015   8.666604526712861
    "06"  2009 -19.937099786950878
    "06"  2010  32.874797814533494
    "06"  2011  48.957582455185715
    "06"  2012  15.666366645702853
    "06"  2013  2.7049818159322867
    "06"  2014   8.010905229120812
    "06"  2015  -34.49525263049765
    "061" 2009 -26.047959050125797
    "061" 2010   38.23646238491703
    "061" 2011   55.66262112444452
    "061" 2012  14.310674749749127
    "061" 2013  1.3745259428381438
    "061" 2014   8.686079467044364
    end

    Comment

    Working...
    X