I have the following data and I want a variable that is 1 if, by firmid, there is at least one observation within the group for which x==1 & y==1, is 2 if, by firmid, all the observations within the group have x==1 & y==0 and, is 3 if, by firmid, all the observations within the group have x==0 & y==1.
Thank you
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str14 firmid float(x y) "00705004000018" 0 1 "00708002100012" 1 0 "00708002100012" 0 1 "00708002100012" 0 1 "00708002100012" 0 1 "01545059600026" 0 1 "01585179300131" 0 1 "01585179300131" 0 1 "01625002900739" 1 0 "01625002900739" 1 0 "03652015300028" 0 1 "04705017400029" 0 1 "05480095800248" 0 1 "05480095800248" 0 1 "05480095800503" 0 1 "05480095800503" 0 1 "05480654200012" 0 1 "05480654200012" 0 1 "05480654200012" 0 1 "05480654200012" 0 1 "05480654200012" 0 1 "05480654203602" 0 1 "05480654203602" 0 1 "05480654203602" 0 1 "05480654203602" 0 1 "05480654203602" 0 1 "05580925500015" 0 1 "05650171100115" 0 1 "05650171100115" 1 0 "05680065901435" 1 0 "05680065901435" 0 1 "05680065901435" 1 0 "05720137800023" 0 1 "05720137800023" 0 1 "05720137800023" 0 1 "05750274200661" 0 1 "05750274200661" 0 1 "05780615000017" 0 1 "05820018900015" 1 0 "05820018900015" 0 1 "05980406200053" 0 1 "06020012800019" 1 1 "06080139600023" 0 1 "06150024500016" 0 1 "06150024500016" 0 1 "06150024500016" 0 1 "06150024500016" 0 1 "06150024500016" 1 0 "06150024500016" 0 1 "06150024500016" 0 1 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900222" 1 0 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900222" 1 0 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900222" 1 0 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900222" 1 0 "06220100900222" 0 1 "06220100900222" 1 1 "06220100900222" 0 1 "06220100900222" 1 0 "06220100900222" 1 0 "06220100900222" 0 1 "06220100900222" 1 0 "06220100900222" 1 0 "06220100900222" 1 1 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900222" 1 0 "06220100900222" 1 1 "06220100900222" 1 1 "06220100900222" 1 1 "06220100900222" 1 1 "06220100900222" 1 0 "06220100900222" 0 1 "06220100900222" 0 1 "06220100900347" 1 0 "06220100900347" 0 1 "06220100900347" 0 1 "06220100900347" 0 1 "06220100900347" 1 1 "06220100900347" 1 0 "06220100900347" 0 1 "06220100900347" 1 0 "06220100900347" 1 1 "06220100900347" 0 1 end
0 Response to conditions by group
Post a Comment