Announcement

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

  • Panel size dummy per state.

    Hello,
    I have a panel of banks for 5 states, and i want to create a size dummy for big and small v/s banks but i want to separate big v/s small per state because the a small bank in NY should be bigger than a small one in other states. So I want to separate per state so that the bigger half gets the dummy big and the other half small. Size will me measured by total_assets.

    Code:
    state id year total_assets
    ""    2 1926       .
    ""    2 1927       .
    "al"  2 1928  565591
    "al"  2 1929  500595
    "al"  2 1930  396844
    "al"  2 1931  422224
    "al"  2 1932  438577
    "al"  2 1933  675957
    "al"  2 1934  759705
    ""    2 1935       .
    ""    3 1926       .
    ""    3 1927       .
    "ga"  3 1928 1089644
    "ga"  3 1929 1007826
    "ga"  3 1930  856899
    "ga"  3 1931  733894
    "ga"  3 1932  617185
    "ga"  3 1933  903580
    "ga"  3 1934 1048342
    ""    3 1935       .
    ""    4 1926       .
    ""    4 1927       .
    "ky"  4 1928 1365027
    "ky"  4 1929 1339294
    "ky"  4 1930 1058206
    "ky"  4 1931 1221944
    "ky"  4 1932 1117723
    "ky"  4 1933 1177041
    "ky"  4 1934 1326697
    ""    4 1935       .
    ""    5 1926       .
    ""    5 1927       .
    "ny"  5 1928 1221832
    "ny"  5 1929 1151022
    "ny"  5 1930  923889
    ""    5 1931       .
    ""    5 1932       .
    ""    5 1933       .
    ""    5 1934       .
    ""    5 1935       .
    ""    6 1926       .
    ""    6 1927       .
    "nj"  6 1928 1482352
    "nj"  6 1929 1641740
    "nj"  6 1930 1350096
    "nj"  6 1931 1927040
    ""    6 1932       .
    ""    6 1933       .
    ""    6 1934       .
    ""    6 1935       .
    Thanks

  • #2
    I'm not sure if I understood well your query, but you may try this code:

    Code:
    by state, sort : egen float meanbank = mean(total_assets)
    by state, sort: gen bigdummy = total_assets > meanbank
    Best regards,

    Marcos

    Comment


    • #3
      It´s quite similar to what i need, but i explained poorly. I want to do exactly what you understood but i need each bank to have the same dummy on every year. This answer gives me different dummys for the same bank when the assets drop or rise from the limit.

      So what i need is to do the same but with the mean of total_assets for each bank so it marks as BIG when the average of total_assets for each bank is bigger than the average total_asset of the state.

      Thanks a lot!

      Comment


      • #4
        This does the trick, thanks!
        Code:
        by bank_index: egen mean_assets = mean(total_assets)
        by state, sort : egen float meanbank = median(total_assets)
        by state, sort: gen bigdummy = mean_assets > meanbank

        Comment


        • #5
          That’s great that you fiddled with the above mentioned code and reached your goal. I just wish to underline that you created a median value in the second command, not the mean.
          Best regards,

          Marcos

          Comment

          Working...
          X