Announcement

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

  • Data of a group

    Hello,

    I have a data with normal firms and zombie firms. Both groups have capital. But I want to generat a variable that represents only the capital of the zombie firms.
    How do I do that?

    Thanks in advance.

  • #2
    This looks like a repeat of https://www.statalist.org/forums/for...osite-variable but if anything it is less clear: the title is is not evocative and there is no definition of normal and zombie firms -- or else you are narrowing this down to a small group of people in exactly your territory who will understand.

    Oddly enough, very few of the most active people who answer questions here are economists working on this kind of data.

    Starting another thread is not a good idea in this circumstance. Better to go back to your previous thread and try to add detail that makes sense to more people, not least a data example.

    Comment


    • #3
      The definition of Zombie firm is (l2.icr <1 & l1.icr < 1 & icr < 1 & age >= 10), where icr is interest coverage ratio. I don't know how to make a title more evocative.

      Its like having a group of males and females. Both have ages. But I want to generat a variable that represents only the age of the males.

      Comment


      • #4
        So you appear to have a code definition, which is excellent, but if so then what is the question?

        I still think you should work at the other thread, but sorry — I don’t what you’re seeking, so I stop there.
        Last edited by Nick Cox; 21 Oct 2019, 14:35.

        Comment


        • #5
          Hi Lucian, I'm not exactly sure what you want. It would be *really* helpful if you could give a sample of your data using Stata's dataex command. If you're not familiar with dataex (and most Stata users aren't) I created a Youtube tutorial here. (I made it too long--feel free to watch at 2x speed, and you may only need the first 6 minutes) .


          But, I created some toy data to give you some ideas of how to do this:

          Code:
          dataex firm_id round_no round_date_str round_amt is_zombie  // Data shared using -dataex-. To install: ssc install dataex
          clear
          input byte(firm_id round_no) str9 round_date_str float round_amt byte is_zombie
          1 1 "1/10/2015"   2 0
          1 2 "6/1/2015"    5 0
          2 1 "4/1/2015"  1.5 1
          2 2 "2/1/2016"    3 1
          3 1 "3/1/2015"    2 1
          3 2 "9/1/2015"   15 1
          3 3 "3/1/2016"   25 1
          3 4 "8/28/2016"  20 1
          4 1 "10/5/2014"  10 0
          4 2 "2/2/2015"   25 0
          5 1 "3/4/2015"    5 1
          5 2 "8/1/2015"   10 1
          5 3 "12/1/2015"  25 1
          5 4 "4/9/2016"   40 1
          end
          
          gen round_date = daily( round_date_str, "MDY")  // converting from string date to Stata date. Functions daily() and date() are identical.
          format round_date %td
          order round_date, after( round_date_str)
          
          . list firm_id round_no round_date round_amt is_zombie, sepby(firm_id) abbrev(12)
          
               +---------------------------------------------------------+
               | firm_id   round_no   round_date   round_amt   is_zombie |
               |---------------------------------------------------------|
            1. |       1          1    10jan2015           2           0 |
            2. |       1          2    01jun2015           5           0 |
               |---------------------------------------------------------|
            3. |       2          1    01apr2015         1.5           1 |
            4. |       2          2    01feb2016           3           1 |
               |---------------------------------------------------------|
            5. |       3          1    01mar2015           2           1 |
            6. |       3          2    01sep2015          15           1 |
            7. |       3          3    01mar2016          25           1 |
            8. |       3          4    28aug2016          20           1 |
               |---------------------------------------------------------|
            9. |       4          1    05oct2014          10           0 |
           10. |       4          2    02feb2015          25           0 |
               |---------------------------------------------------------|
           11. |       5          1    04mar2015           5           1 |
           12. |       5          2    01aug2015          10           1 |
           13. |       5          3    01dec2015          25           1 |
           14. |       5          4    09apr2016          40           1 |
               +---------------------------------------------------------+
          
          egen total_raised = total(round_amt), by(firm_id)  // calculating total amount raised by each firm
          gen round_yr = year( round_date)  // extracting the year for each round
          
          
          . table is_zombie, c(sum round_amt) row col
          -------------------------
          is_zombie | sum(round_~t)
          ----------+--------------
                  0 |            42
                  1 |         146.5
                    | 
              Total |         188.5
          -------------------------
          
          . table round_yr is_zombie, c(sum round_amt) row col
          
          -------------------------------
                    |      is_zombie     
           round_yr |     0      1  Total
          ----------+--------------------
               2014 |    10            10
               2015 |    32   58.5   90.5
               2016 |           88     88
                    | 
              Total |    42  146.5  188.5
          -------------------------------
          
          
           table round_yr if is_zombie==1, c(sum round_amt) row col
          
          -------------------------
           round_yr | sum(round_~t)
          ----------+--------------
               2015 |          58.5
               2016 |            88
                    | 
              Total |         146.5
          -------------------------
          
          egen total_by_category = total(round_amt), by(is_zombie)  // creates a total for zombie vs not_zombie
          sort is_zombie firm_id round_no
          
          . list firm_id round_no round_date round_amt total_raised total_by_category is_zombie, sepby(firm_id) abbrev(18)
          
               +--------------------------------------------------------------------------------------------+
               | firm_id   round_no   round_date   round_amt   total_raised   total_by_category   is_zombie |
               |--------------------------------------------------------------------------------------------|
            1. |       1          1    10jan2015           2              7                  42           0 |
            2. |       1          2    01jun2015           5              7                  42           0 |
               |--------------------------------------------------------------------------------------------|
            3. |       4          1    05oct2014          10             35                  42           0 |
            4. |       4          2    02feb2015          25             35                  42           0 |
               |--------------------------------------------------------------------------------------------|
            5. |       2          1    01apr2015         1.5            4.5               146.5           1 |
            6. |       2          2    01feb2016           3            4.5               146.5           1 |
               |--------------------------------------------------------------------------------------------|
            7. |       3          1    01mar2015           2             62               146.5           1 |
            8. |       3          2    01sep2015          15             62               146.5           1 |
            9. |       3          3    01mar2016          25             62               146.5           1 |
           10. |       3          4    28aug2016          20             62               146.5           1 |
               |--------------------------------------------------------------------------------------------|
           11. |       5          1    04mar2015           5             80               146.5           1 |
           12. |       5          2    01aug2015          10             80               146.5           1 |
           13. |       5          3    01dec2015          25             80               146.5           1 |
           14. |       5          4    09apr2016          40             80               146.5           1 |
               +--------------------------------------------------------------------------------------------+
          I'm not sure if any of this is giving you what you want, but hopefully it can help get you started.

          Comment

          Working...
          X