Announcement

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

  • weights not allowed ?

    Hi,

    i'm trying to finish the data preparation for my thesis:

    *** BEDINGUNGEN EINFÜGEN ***

    *1. Nur weibliche Ankerpersonen behalten* (only female anchor)

    keep if sex_gen== 2 // 1.371 Beobachtungen gelöscht (Obs. deleted)

    *2. Beobachtungen zu mindestens 3 Zeitpunkten*

    bysort id (wave): gen n= _N
    drop if n <=2 // 751 Beobachtungen gelöscht

    *3. Missings löschen* (delete Missings)

    mvdecode _all ,mv (-99/-1=.a)
    egen missings = rowmiss (_all)
    keep if missings == 0 // 232 Beobachtungen gelöscht

    *3. Zusammenhängende Beobachtungsreihen identifizieren* (identify obs. gaps with a dummy)

    bysort id (wave): generate gap = 0 if _n == 1 // the value of the first obs. is 0
    bysort id (wave): replace gap = 0 if wave [_n-1] == (wave-1) // if there is no gap (if there is no gap between the previous and the current wave it's also set 0

    but stata says: 'weights not allowed​​​​'​​​

    I read that it's because of the '_n' but i don't know how or what to change. Whats wrong?

    THANK YOU!


  • #2
    I will just point you to the FAQs for reading more about our preferences for full real names, using code delimiters, etc. and not further comment.

    The problem seems to be a blank space character in

    Code:
    bysort id (wave): replace gap = 0 if wave [_n-1] == (wave-1) // if there is no gap (if there is no gap between the previous and the current wave it's also set 0
    Remove the space after wave

    Code:
    bysort id (wave): replace gap = 0 if wave[_n-1] == (wave-1) // if there is no gap (if there is no gap between the previous and the current wave it's also set 0
    Whether the code does what you want and whether you really need balanced panel data, I can obviously not tell.

    Best
    Daniel

    Comment


    • #3
      Hey Daniel,

      sorry, thanks for telling me. I'll read this carefully asap. I tried to change my name but there is no option in the settings.

      Code:
       
       bysort id (wave): replace gap = 0 if wave[_n-1] == (wave-1)
      Tank you!! It worked.

      But you are right I don't know at all what I'm doing. I read this on the Internet. It's my first experience with panel data, so I'm a bit lost and the support at university is really bad.

      Comment


      • #4
        Guest:

        You said:

        I tried to change my name but there is no option in the settings.
        This is already answered in the FAQ Advice. Send an email to the Administrators using the CONTACT US button (below this thread).

        6. Why are real names preferred?



        You are asked to post on Statalist using your full real name, including given name(s) and a family name, such as "Ronald Fisher" or "Gertrude M. Cox". Giving full names is one of the ways in which we show respect for others and is a long tradition on Statalist. It is also much easier to get to know people when real names are used.

        If you overlook this on first registration, it is easy to fix. Click on “Contact us” located at the bottom right-hand corner of every page.
        Last edited by sladmin; 28 Jan 2019, 09:30. Reason: anonymize original poster

        Comment


        • #5
          Originally posted by Nick Cox View Post
          Guest:

          You said:



          This is already answered in the FAQ Advice. Send an email to the Administrators using the CONTACT US button (below this thread).
          I already saw it in the FAQ but thank you anyway!
          Last edited by sladmin; 28 Jan 2019, 09:30. Reason: anonymize original poster

          Comment


          • #6
            I was just asking about the balanced panel because most (dare I say all) estimators implemented in Stata handle unbalanced panels. Details depend, of course, on the specific research questions your are trying to answer and the nature of your data.

            Best
            Daniel

            Comment

            Working...
            X