Announcement

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

  • Making a dummy for threshold


    Hi,

    I am going to make a dummy Ii ( Em (i)<= Em) that selects firms whose employment (Em(i)) is below a certain threshold, the median of employment over the sample.
    firms ID: NPC_FIC
    Employment: Em

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double NPC_FIC float Em
    500008310   1
    500027353   3
    500049799   2
    500050215   2
    500135017   7
    500139105   2
    500154496  28
    500206942   3
    500251226   2
    500265754   1
    500321035   3
    500369375   2
    500392001   1
    500392920   1
    500422489   1
    500458395   1
    500979142 145
    500979162  16
    500979181   8
    500979184  12
    500979206  34
    500979220  32
    500979239   7
    500979255  32
    500979269  68
    500979271  10
    500979282   4
    500979284   7
    500979293  63
    500979319   3
    500979326   8
    500979329  27
    500979360   4
    500979373  33
    500979374  10
    500979383  78
    500979450  14
    500979456  51
    500979474  89
    500979489  14
    500979491  22
    500979522  13
    500979524   5
    500979526  16
    500979530  22
    500979531   5
    500979532  59
    500979537  31
    500979543  18
    500979551  11
    500979559   2
    500979561   6
    500979563  18
    500979564  27
    500979566  34
    500979567  26
    500979569  30
    500979574  10
    500979596  53
    500979625   8
    500979634  17
    500979645   2
    500979673   3
    500979679  10
    500979689   2
    500979712   3
    500979737  12
    500979740  46
    500979749   1
    500979750  66
    500979758  21
    500979809  22
    500979810   5
    500979812   1
    500979820  55
    500979838  22
    500979871   1
    500979874   8
    500979890   9
    500979935   6
    500979937   1
    500979940   6
    500979959 100
    500979962   6
    500979964 310
    500979981 227
    500979987 565
    500979989   2
    500980043  17
    500980048 204
    500980053  76
    500980077   4
    500980081  39
    500980087   1
    500980105   3
    500980109   5
    500980110  15
    500980146   4
    500980167   9
    500980175  23
    end

    Listed 100 out of 24599 observations

    First, I made the median:
    Code:
    egen median_Employment = median( Employment)
    Now, I need to make a dummy that selects firms whose employment is below the median of employment over the sample.
    Any suggestion is appreciated.

    Cheers,
    Paris


  • #2
    Code:
    gen byte wanted = (Employment < median_Employment) if !missing(Employment, median_Employment)

    Comment


    • #3
      It worked perfectly. Thank you for your constant assistance.

      Comment

      Working...
      X