Announcement

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

  • Creating an indicator variable for wether a firm has ever appeared in the VTCS

    Hello,

    I have data which looks like this:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double madn float(year vtcs)
      40983 2009 0
     657974 2009 0
      58384 2009 0
     503806 2009 0
     469691 2009 0
     491887 2009 0
     663452 2009 0
     674052 2010 0
     503249 2010 1
     517828 2010 0
     263282 2010 0
     603634 2010 0
     558839 2010 0
      25433 2010 0
      76785 2010 0
     767779 2010 0
     537922 2011 0
     869724 2011 0
     768939 2011 0
     755050 2011 0
     566625 2011 0
     461782 2011 0
     862856 2011 0
     610384 2011 0
     613996 2011 0
      21760 2011 0
     464397 2012 1
      58320 2012 0
     738165 2012 0
     181272 2012 0
       6751 2012 1
     943675 2012 0
     562109 2012 0
     850607 2012 0
     668821 2012 0
     671974 2012 0
     920957 2012 0
     430130 2012 0
     620965 2013 0
     980279 2013 0
     429632 2013 0
     930345 2013 0
     960199 2013 0
     807407 2013 0
     241179 2013 0
     469478 2013 0
     474706 2013 0
    1024415 2013 0
     667954 2013 0
      10427 2014 0
    1063752 2014 0
     909629 2014 0
     841458 2014 0
     766508 2014 0
     742306 2014 0
     630074 2014 0
     945271 2014 0
     253005 2014 0
    1040758 2014 0
     119730 2014 1
     839932 2015 0
    1108048 2015 0
     974129 2015 0
     813668 2015 0
     668815 2015 0
     400541 2015 1
    1008688 2015 0
    1142826 2015 0
     544564 2015 0
    1107967 2015 0
     431665 2015 0
    1025679 2015 0
     110024 2015 0
        497 2016 0
    1305420 2016 0
     859535 2016 0
     916536 2016 0
    9041740 2016 0
     815906 2016 0
    1237553 2016 0
     874416 2016 0
     903941 2016 0
    1163463 2016 0
    1215855 2016 0
    1265152 2016 0
    1231087 2016 0
     959488 2017 0
     540451 2017 0
     517943 2017 0
     884886 2017 0
     504973 2017 0
    1246044 2017 0
    1411118 2017 0
    1009290 2017 0
    1336730 2017 0
     515246 2017 0
    1010370 2017 0
    1305820 2017 0
     972660 2017 0
     892899 2017 0
    end
    label var madn "Firm identifier"
    I took a random sample of 100 observations in the example above. But basically I'm dealing with panel data, the variable 'madn' is used as a firm identifier, 'year' is the time variable and the 'vtcs' variable indicates wether a firm answered the tech survey issued for that specific year. For example the entry '400541 2015 1' : 'madn year vtcs' indicates that the firm identified by madn = 400541 answered the tech survey in 2015.

    I'm not sure how often this occurs in the random sample above (probably not often), but ideally the same firm should appear at least once in each year (cases where they appear more than once in a given year is a duplicates problem, which I'm not worried about right now).

    I want to create an indicator variable which gives me the set of firms that have answered the VTCS questionnaire at least once in any given year.

    So if the firm has answered the tech survey at least once in any given year, this indicator variable would equal 1 for all observations with the corresponding 'madn' identifier for that firm, if the firm has never answered the tech survey the indicator variable is 0.

    How can Identify this set of firms?

    Thanks,
    Jad

    Last edited by Jad Tamimi; 11 Mar 2024, 16:04.

  • #2
    Unfortunately I put this in the wrong topic section I will move it over now.

    Comment

    Working...
    X