Announcement

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

  • How to apply a "weighting variable" created by SPSS

    Dear Users of Stata,
    I am a new user and using a dataset that is converted into Stata from SPSS. There is a "weighting variable" in the dataset that I need to apply when running logistic regression. In SPSS, I can simply click the weighting variable to enable weighting, but I couldn't find information on how to do it in Stata.
    Does anyone know how to apply the weighted variable when running logistic regression in Stata? Thank you.

  • #2
    It sounds as if you have a dataset from a survey, and that the ‘weighting variable’ is what Stata refers to as a ‘survey weight’ variable.
    If this is true, you should confer the manual on survey data, https://www.stata.com/manuals/svysvy.pdf. In particular, you should read about declaring data to be survey data using the svyset command. Once you have declared the data to be survey data, you can use most commands, e.g logit, following the svy: prefix

    Comment


    • #3
      Dear Andre,
      Thank you for your reply. Yes, the dataset is from a national survey. Thank you for the link to the document. I will read it, and hopefully I can use the weighting variable that SPSS created.

      Comment


      • #4
        Also see:

        Code:
        help weights
        You may not necessarily need the svy prefix, unless you have stratification. With probability weights,

        Code:
        logit y x1... xn [pw=weight_var]
        On the other hand, if you have frequency weights:

        Code:
        logit y x1... xn [fw=weight_var]

        where you replace "weight_var" with your weight variable. Compare the output of these with what you get from SPSS.

        Comment


        • #5
          Dear Andrew,
          Thank you for your reply. I added svyset[pweight=weighting variable] and worked. Thank you.

          Comment

          Working...
          X