Announcement

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

  • Retaining respondent information when removing respondent rows

    Hi there,

    I am currently working with data which has an ID variable with 2 respondent rows (main and partner) each. I have managed to create variables showing the partner respondent and main respondents smoking status, however when i drop all partner respondent rows i loose the partners smoking status. How do i create 2 separate variables which show the main respondent and partner respondents smoking status so that when i remove all partner rows, the information on both main respondent and partner respondent is retained?

    Currently i am using the egen (max) command but it doesnt appear to be working the way i would like.

    I do hope you can advise.

    Best wishes,
    Ami

  • #2
    Although you have tried to describe your situation, too much is left to the imagination to make concrete advice possible. In order to help you, people will need to see:

    1. Representative example data from your Stata data set. To be useful, this must be posted using the -dataex- command. If you are running version 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    2. The exact code you are using, and the results you are getting from Stata, including any error messages.

    3. A specific explanation of how the code is not producing the results you want. Just saying it doesn't appear to be working the way you would like requires others to read your mind about what you would like and what you are getting.

    Comment

    Working...
    X