Announcement

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

  • Descriptive statistic in panel analysis multiple ifs

    Hello to all,
    I’m using STATA 16.
    I have a panel data frame with 2 waves. Before and while the Corona Pandemic. The topic is the division of labor. I would like to know how the division of labor is during the pandemic, when previously both partners did the same amount of work. The data frames are separated by sex.
    Variables: division of labor (short DL) (1 completely me, 2 mostly me, 3 equal, 4 mostly partner, 5 completely partner), wave (1= before corona, 2=while corona).

    I tried:
    tab DL if wave==2 DL if wave==1 & DL==3
    this is invalid
    bysort wave: ta DL DL if DL==3
    and this doesn’t show the right thing.

    Do you have any idea?

    Many Thanks,
    Anna

  • #2
    With multiple -if- qualifiers, additional conditions become "&". In your case, it it difficult to interpret what you want as your conditions seem to imply (if condition 1 or condition 2) and not (if condition 1 and condition 2).

    tab DL if wave==2 DL if wave==1 & DL==3
    Below, tabulate DL if "wave==2" or "wave==1 & DL==3"

    Code:
    tab DL if wave==2 | (wave==1 & DL==3)
    "|" implies or. See also

    Code:
    help inlist()
    for inclusion of multiple & conditions.

    Comment


    • #3
      Hello! In order for us to actually give any useful hints or help, it'd be great if you can do the followings:

      1) Refer to the FQA (http://www.statalist.org/forums/help), and follow step 12 and use -dataex- to post your sample data. Sometimes problems may lie in the format of the data, which cannot be explained through text description.
      2) Instead of "this is invalid" and "this doesn't show the right thing", paste any errors that Stata returned to you.

      Look forward to the additional information.

      Comment


      • #4
        i'm really sorry im not allowed to share parts of the data...

        i actually just need a frequency table or crosstab with multiple conditions.
        It is important that a variable only shows the division of labor (DL) that is equally distributed before the pandemic. So the wave contains 1 and DL=3
        The second one should show all cases of DL in wave 2. This way I can see where the division of labor evolves in pandemic times if it was equal before.
        wave and DL are float

        I want no or conditions but only &
        in the code: tab DL if wave==2 DL if wave==1 & DL==3
        the error says: invalid DL
        i thought it is because tab cannot use 2 if conditions in the two variables

        I hope it was now a little better understandable

        Comment


        • #5
          Your difficulty about posting data is already addressed in the link given by Ken Chui in #3:

          If your dataset is confidential, then provide a fake example instead.
          The difficulty with your syntax was explained by Andrew Musau in #2. Multiple if conditions are given by using operators such as | or & -- not by repeating if.

          It seems to me that
          Code:
          tab DL wave
          will provide the information you seek, You won't get a cross-tab by mentioning one variable with multiple if conditions.

          Comment


          • #6
            DL: 1 volls
            Partner; 5 wave
            volls ich 1 2 Total
            1 7 14 21
            2 35 41 76
            3 280 276 556
            4 365 319 684
            5 189 267 456
            Total 876 917 1,793
            This is the crosstab for: tab DL wave

            But i need to know where the 280 in wave 1 DL==3 evolve in wave 2
            do they stay 3 or to they become something different?

            Many thanks for the help by the way!


            Comment


            • #7
              Still no data example....

              See https://www.statalist.org/forums/for...-data-of-firms for some technique.

              Comment


              • #8

                Code:
                * Example generated by -dataex-. To install: ssc install dataex
                clear
                input float(welle ATH) long id
                1 3  1133000
                2 .  1133000
                1 3  1420000
                2 3  1420000
                2 5  1624000
                1 5  1624000
                1 2  1665000
                2 3  1665000
                2 4  1909000
                1 5  1909000
                2 5  2546000
                1 4  2546000
                2 .  3491000
                1 .  3491000
                2 4  3651000
                1 4  3651000
                1 5  6151000
                2 5  6151000
                1 3  6465000
                2 3  6465000
                2 5  8075000
                1 4  8075000
                1 5  9657000
                2 5  9657000
                1 4 10665000
                2 4 10665000
                1 3 10809000
                2 3 10809000
                2 3 10957000
                1 3 10957000
                1 2 11295000
                2 3 11295000
                1 2 12092000
                2 3 12092000
                2 . 16402000
                1 4 16402000
                1 4 16629000
                2 4 16629000
                2 . 16806000
                1 . 16806000
                1 3 17018000
                2 . 17018000
                2 5 17960000
                1 4 17960000
                1 5 21088000
                2 5 21088000
                2 . 22083000
                1 . 22083000
                2 4 23561000
                1 . 23561000
                2 . 24908000
                1 5 24908000
                2 5 26265000
                1 5 26265000
                2 3 29457000
                1 3 29457000
                2 5 30631000
                1 5 30631000
                2 4 31743000
                1 4 31743000
                2 . 33828000
                1 . 33828000
                1 . 34293000
                2 . 34293000
                2 3 34452000
                1 3 34452000
                2 5 35799000
                1 5 35799000
                2 4 36504000
                1 4 36504000
                2 4 39291000
                1 4 39291000
                1 5 40826000
                2 4 40826000
                1 3 41571000
                2 3 41571000
                1 5 41686000
                2 . 41686000
                1 . 41957000
                2 . 41957000
                2 . 42394000
                1 . 42394000
                2 5 42573000
                1 4 42573000
                2 4 42654000
                1 3 42654000
                2 4 43181000
                1 4 43181000
                2 4 45374000
                1 4 45374000
                2 3 53887000
                1 3 53887000
                2 . 56217000
                1 . 56217000
                1 . 58682000
                2 . 58682000
                1 4 60683000
                2 5 60683000
                1 3 61227000
                2 4 61227000
                end

                Comment


                • #9
                  Thanks for your example. A cross-tabulation of ATH against ATH in the next wave may help, as for example. See also help tabulate for options to calculate extra quantities.


                  Code:
                  . xtset id welle 
                  
                  Panel variable: id (strongly balanced)
                   Time variable: welle, 1 to 2
                           Delta: 1 unit
                  
                  . 
                  . gen F1ATH = F1.ATH 
                  (64 missing values generated)
                  
                  . 
                  . tab ATH F1ATH if welle == 1 
                  
                             |              F1ATH
                         ATH |         3          4          5 |     Total
                  -----------+---------------------------------+----------
                           2 |         3          0          0 |         3 
                           3 |         8          2          0 |        10 
                           4 |         0          8          5 |        13 
                           5 |         0          2          7 |         9 
                  -----------+---------------------------------+----------
                       Total |        11         12         12 |        35 
                  
                  . 
                  . tab ATH F1ATH if welle == 1, missing 
                  
                             |                    F1ATH
                         ATH |         3          4          5          . |     Total
                  -----------+--------------------------------------------+----------
                           2 |         3          0          0          0 |         3 
                           3 |         8          2          0          2 |        12 
                           4 |         0          8          5          1 |        14 
                           5 |         0          2          7          2 |        11 
                           . |         0          1          0          9 |        10 
                  -----------+--------------------------------------------+----------
                       Total |        11         13         12         14 |        50
                  I can't illustrate wave 2 to wave 3 from your data example, but the principle is generic.

                  Comment

                  Working...
                  X