Announcement

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

  • Creating Dummy Variable

    Dear Statalist Experts

    I need to create a dummy variable from the following variable "A" with top and bottom 20%.
    Dummy = 1 if the variable A is in the top or bottom 20%. 0 otherwise.

    That'll be great if I can create a separate variable with actual values with the same parameters.

    Thank you so much.
    QURESHI, Qazi


    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float A
              .
     .035367593
    -.007754944
     -.03751326
    -.005388259
     .025513375
     .034206796
     -.12018293
              .
              .
     -.08941586
     -.24886952
      -.0966722
     -.09120546
              .
      -.2598351
      -.2656539
    -.032589648
     -.10558058
              .
    -.026115904
     -.04731255
     -.11949994
     -.04928521
              .
              .
      .02226777
     -.05854624
      .11488034
     -.13876732
      .53168947
      .03532645
              .
              .
     .024657283
      .05479456
    -.006728888
    -.007066709
              .
              .
              .
              .
              .
              .
              .
              .
              .
              .
              .
      .04400846
      .02803047
       .0306746
      .15099134
              .
              .
      .04004798
     .034285568
      .04048123
              .
      .50490487
              .
              .
              .
              .
              .
              .
              .
      .09186901
     -.53324586
              .
              .
     -.08416321
     -.09676182
     .034453392
      .06999123
      -.3752935
              .
              .
     .014568573
    -.022249155
              .
    -.005968199
     .015290773
     .018466849
     -.02775632
              .
     -.10529243
       .3638915
              .
     .009061279
     -.10935211
      -.3770917
     -.15895937
              .
     .037136786
              .
              .
              .
              .
     -.08634812
    end

  • #2
    Look up xtile
    Code:
    h xtile

    Comment


    • #3
      Thanks Jared.

      Comment

      Working...
      X