Announcement

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

  • split the dataset ( pre and post)

    Dear all

    I am dealing with a quarterly panel dataset – from Oct 2019 to Des 2020 – for workers, and I want to study the effect of a covid_19 closure in labour market. So I have five quarters in my datasets: Oct to Des 2019, the first quarter (the only quarter before closure in the labour market as well), and the other four quarters, all of them the period after closure. My question is: How can I separate my dataset to be pre and post period based on quarter and variable FLEXW7?

    I would like to get the untreated group ( Oct to Des 2019 ) and the treated group ( Jan to Des 2020) based on people working in Zero hours contracts ( FLEXW7)

    NOTE :
    FLEXW7 is a group of works which indicate 1 = if working zero hours contracts 0 = not working zero hours contracts

    Here is the sample of data :
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double PERSID byte(quarter SEX Inde07m FLEXW7)
    10493040101 4 2 99 .
    10493040101 5 2 99 .
    10493040101 6 2 99 .
    10493040101 7 2 99 .
    10694020101 4 2 99 .
    10694020101 5 2 99 .
    10694020101 6 2 99 .
    10694020101 7 2 99 .
    10694020101 8 2 99 .
    10694020102 4 1 99 .
    10694020102 5 1 99 .
    10694020102 6 1 99 .
    10694020102 7 1 99 .
    10694020102 8 1 99 .
    10792030101 5 2 99 .
    10792030101 6 2 99 .
    10793010101 4 2  8 2
    10793010101 5 2  8 2
    10793010101 6 2  8 2
    10793010101 7 2  8 2
    10794010101 4 1  5 2
    10794010101 5 1  5 2
    10794010101 6 1  5 2
    10794010101 7 1  5 2
    10794010101 8 1  5 2
    10794010102 4 2  5 2
    10794010102 5 2  5 2
    10794010102 6 2  5 2
    10794010102 7 2  5 2
    10794010102 8 2  5 2
    10993020101 4 2  8 2
    10993020101 5 2  8 .
    10993020101 6 2  8 2
    10993020101 7 2 99 .
    10993020102 4 1  8 2
    10993020102 5 1  8 2
    10993020102 6 1  8 2
    10993020102 7 1  8 2
    11091010101 4 2  8 2
    11091010101 5 2  8 2
    11093030101 4 2 99 .
    11093030101 5 2 99 .
    11093030101 6 2 99 .
    11093030101 7 2 99 .
    11094010101 4 1  8 2
    11094010101 5 1 99 .
    11094010101 6 1 99 .
    11094010101 7 1 99 .
    11094010101 8 1 99 .
    11094010102 4 2  8 2
    11094010102 5 2  8 2
    11094010102 6 2  8 2
    11094010102 7 2  8 2
    11094010102 8 2  8 2
    11291020101 4 2 99 .
    11291020101 5 2 99 .
    11292020101 5 1  5 2
    11292020101 6 1  5 2
    11294030101 4 2  8 2
    11294030101 5 2  8 2
    11294030101 6 2  8 2
    11294030101 7 2  8 2
    11294030101 8 2  8 2
    11294030102 4 1 99 .
    11294030102 5 1 99 .
    11294030102 6 1 99 .
    11294030102 7 1 99 .
    11294030102 8 1 99 .
    20191020101 4 1  8 2
    20191020101 5 1  8 2
    20191020102 4 1  5 2
    20191020102 5 1  5 2
    20191040101 4 2  9 2
    20191040101 5 2  9 2
    20193010102 4 2 99 .
    20193010102 5 2 99 .
    20193010102 6 2 99 .
    20193010102 7 2 99 .
    20293010101 4 2 99 .
    20293010101 5 2 99 .
    20293010101 6 2 99 .
    20293010101 7 2 99 .
    20294040101 4 2  5 2
    20294040101 5 2  5 2
    20294040101 6 2  5 2
    20294040101 7 2  5 2
    20294040101 8 2  5 2
    20493010101 4 2 99 .
    20493010101 5 2 99 .
    20493010101 6 2 99 .
    20493010101 7 2 99 .
    20494030101 4 2  5 2
    20494030101 5 2  5 2
    20494030101 6 2  5 2
    20494030101 7 2  5 2
    20494030101 8 2  5 2
    20494030102 4 1  8 2
    20494030102 5 1  8 2
    20494030102 6 1  8 2
    20494030102 7 1  8 2
    end
    label values quarter quarter
    label def quarter 4 "Oct-Des 2019", modify
    label def quarter 5 "Jan-Mar 2020", modify
    label def quarter 6 "April-June 2020", modify
    label def quarter 7 "July-Sep 2020", modify
    label def quarter 8 "Oct-Des 2020", modify
    label values SEX SEX
    label def SEX 1 "Male", modify
    label def SEX 2 "Female", modify
    label values Inde07m Inde07m5
    label def Inde07m5 5 "G,I -Distribution, hotels and restaurants", modify
    label def Inde07m5 8 "O,P,Q - Public admin, education and health", modify
    label def Inde07m5 9 "R,S,T,U - Other services", modify
    label values FLEXW7 FLEXW75
    label def FLEXW75 2 "No", modify


    I tried to create a dummy variable
    Code:
    gen byte ZHC_post = FLEXW7 == 1 & quarter>=5
    gen byte ZHC_pre = FLEXW7 == 1 & quarter==4
    However, that did not work when I needed to produce a Histogram graph to compare people working in zero-hours contracts pre and post period.

    I appreciate getting any suggestions to solve this.

  • #2
    The text of the question says that FLEXW7 takes on values of 1 and 0, but in the data example FLEXW7 only takes on 2 and missing (.) where 2 is labeled as "No."

    Comment


    • #3
      Originally posted by Ken Chui View Post
      The text of the question says that FLEXW7 takes on values of 1 and 0, but in the data example FLEXW7 only takes on 2 and missing (.) where 2 is labelled as "No."
      Yes, this my mistake in the question sorry for that , the FLEXW7 takes on value "1" if working zero hours contracts labelled "Yes" and 2 if not working zero hours contracts labelled "No" also the variable has missing value (.)

      Comment

      Working...
      X