Announcement

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

  • Panel dummy variable

    Hi,

    Asking a relatively simple question.

    I am doing a study that deals with after and before covid-19 shocks. Therefore, the dummy variable seems more effective for this study. We want to set up 1 if the data point after 2019q1 , otherwise, equal to zero. As the data set belongs to panel id, accordingly, the same dummy will be applied for all ids.

    Any advice will be appreciated.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(id qdate) double(Ind_Production ex_rate) str27 emp
    1 224  94.26666666666667  103.9144096600312 "98.2"            
    1 225  99.39999999999999 103.18426059244827 "100.2"            
    1 226  94.23333333333333 102.81918605865681 "102.5"            
    1 227 133.73333333333335   94.7976872745166 "100.8"            
    1 228 101.96666666666665   92.0799101896246 "98.8"            
    1 229 103.03333333333335  94.09796108474964 "101.8"            
    1 230 110.10000000000001  92.84048213502348 "105.7"            
    1 231 140.53333333333333  87.47591468014338 "104.6"            
    1 232 112.13333333333333  86.21843573041721 "102.4"            
    1 233 115.43333333333334  79.20089191420354 "105.5"            
    1 234              117.3  63.34043161281886 "107.1"            
    1 235              132.4  77.42622404160615 "103.6"            
    1 236 109.40000000000002  76.34114139950374 "100.3"            
    1 237 112.10000000000001   73.2380078622763 "103.4"            
    1 238 117.66666666666667  77.88256720884547 "107.7"            
    1 239              138.7   77.2538277339824 "107.4"            
    1 240              116.5  73.98843884840319 "105"              
    1 241 105.63333333333333  70.15515624359284 "105.4"            
    1 242 121.26666666666667  63.16803530519511 "111.6"            
    1 243 144.83333333333334 63.036202834659306 "112.5"            
    2 224  91.56666666666666  103.9144096600312 "102.8"            
    2 225                107 103.18426059244827 "106.9"            
    2 226  96.83333333333333 102.81918605865681 "108.3"            
    2 227 114.33333333333333   94.7976872745166 "108.2"            
    2 228               82.8   92.0799101896246 "104.2"            
    2 229               89.8  94.09796108474964 "107.3"            
    2 230              102.3  92.84048213502348 "111.7"            
    2 231 126.83333333333333  87.47591468014338 "117.4"            
    2 232                103  86.21843573041721 "120.3"            
    2 233 105.46666666666668  79.20089191420354 "122.9"            
    2 234 104.76666666666665  63.34043161281886 "126.1"            
    2 235              127.3  77.42622404160615 "128.5"            
    2 236 116.13333333333333  76.34114139950374 "127.6"            
    2 237 109.89999999999999   73.2380078622763 "131.4"            
    2 238  99.10000000000001  77.88256720884547 "135.1"            
    2 239  93.60000000000001   77.2538277339824 "137.5"            
    2 240  98.63333333333333  73.98843884840319 "134.5"            
    2 241 100.60000000000001  70.15515624359284 "139.9"            
    2 242 112.86666666666667  63.16803530519511 "146.2"            
    2 243 105.23333333333333 63.036202834659306 "166.1"            
    3 224 101.33333333333333  103.9144096600312 "99.2"            
    3 225 105.86666666666666 103.18426059244827 "99"              
    3 226  89.60000000000001 102.81918605865681 "99"              
    3 227 109.33333333333333   94.7976872745166 "99.8"            
    3 228 102.43333333333332   92.0799101896246 "98.8"            
    3 229 105.96666666666665  94.09796108474964 "99.8"            
    3 230 104.46666666666668  92.84048213502348 "101.6"            
    3 231 118.76666666666667  87.47591468014338 "103.5"            
    3 232 111.96666666666665  86.21843573041721 "104.2"            
    3 233 110.96666666666665  79.20089191420354 "103.9"            
    3 234 105.86666666666667  63.34043161281886 "103.1"            
    3 235 112.33333333333333  77.42622404160615 "102"              
    3 236 107.43333333333332  76.34114139950374 "100.9"            
    3 237              109.7   73.2380078622763 "102.2"            
    3 238 109.96666666666665  77.88256720884547 "103.2"            
    3 239 123.13333333333333   77.2538277339824 "105.3"            
    3 240 116.06666666666666  73.98843884840319 "106.3"            
    3 241  76.93333333333334  70.15515624359284 "102.7"            
    3 242              122.5  63.16803530519511 "107.6"            
    3 243              138.4 63.036202834659306 "112.3"            
    4 224 104.46666666666665  103.9144096600312 "98.3"            
    4 225 109.89999999999999 103.18426059244827 "97.3"            
    4 226               97.5 102.81918605865681 "96.09999999999999"
    4 227              102.3   94.7976872745166 "96.40000000000001"
    4 228  99.83333333333333   92.0799101896246 "95.5"            
    4 229 104.36666666666667  94.09796108474964 "97.2"            
    4 230 112.76666666666667  92.84048213502348 "99.40000000000001"
    4 231 117.23333333333335  87.47591468014338 "101.5"            
    4 232 112.89999999999999  86.21843573041721 "103.1"            
    4 233 111.46666666666665  79.20089191420354 "103.2"            
    4 234 112.43333333333334  63.34043161281886 "104.5"            
    4 235 114.13333333333333  77.42622404160615 "106.6"            
    4 236 114.96666666666665  76.34114139950374 "107.6"            
    4 237 115.39999999999999   73.2380078622763 "110.4"            
    4 238              124.5  77.88256720884547 "113"              
    4 239 127.39999999999999   77.2538277339824 "115.8"            
    4 240 118.13333333333333  73.98843884840319 "118.7"            
    4 241  74.66666666666667  70.15515624359284 "113.5"            
    4 242 129.43333333333334  63.16803530519511 "118.7"            
    4 243 127.80000000000001 63.036202834659306 "120.8"            
    5 224  95.03333333333332  103.9144096600312 "99.59999999999999"
    5 225 112.76666666666667 103.18426059244827 "98.59999999999999"
    5 226              100.5 102.81918605865681 "97.8"            
    5 227                124   94.7976872745166 "99.09999999999999"
    5 228              104.7   92.0799101896246 "96.8"            
    5 229 115.76666666666667  94.09796108474964 "99.09999999999999"
    5 230                119  92.84048213502348 "102.9"            
    5 231              128.1  87.47591468014338 "105"              
    5 232              108.5  86.21843573041721 "104.8"            
    5 233              114.3  79.20089191420354 "103.7"            
    5 234 108.89999999999999  63.34043161281886 "103.9"            
    5 235 107.23333333333333  77.42622404160615 "99.5"            
    5 236  84.73333333333333  76.34114139950374 "92.90000000000001"
    5 237  97.06666666666666   73.2380078622763 "92.3"            
    5 238 100.86666666666667  77.88256720884547 "92.2"            
    5 239 110.10000000000001   77.2538277339824 "94.2"            
    5 240  98.06666666666666  73.98843884840319 "94"              
    5 241  90.53333333333335  70.15515624359284 "92.8"            
    5 242 119.16666666666667  63.16803530519511 "97.5"            
    5 243 135.33333333333334 63.036202834659306 "103.5"            
    end
    format %tq qdate
    Last edited by Muhammad Salahuddin; 18 Mar 2022, 13:20.

  • #2
    Code:
    generate covid = qdate > tq(2019q1)

    Comment


    • #3
      Thank you very much. It is working

      Comment

      Working...
      X