Announcement

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

  • Avergaing values of variables to reduce survey observations

    Hi,

    I am looking for a solution to average the survey respones.
    Below S007 is suvey respondent ID, loc is country name and fyear is the year. the variables B010 through B031 are the answers by each survey respondents, are labelled as string but there is a number behind varying from -4 to 4.

    I need the respone consolidated for all respondents, like an average response for every loc and fyear.
    Could someone help me achieve this please.

    Much appreciated and many thanks in advance.

    Click image for larger version

Name:	1.JPG
Views:	1
Size:	195.0 KB
ID:	1695011

  • #2
    Averaging the numeric responses here is probably a bad idea. I can see in the screenshot that these responses include "Not ask..." which probably should be treated as a missing value. Averaging in the numeric code that is labeled as "Not ask..." with numeric codes that represent yes and no is going to lead to meaningless results.

    So in order to work around this, we need to see the complete numeric coding of those answers so we can tell which ones need to be excluded from averaging. In fact, this is just one instance of the more general situation outlined in the FAQ: screen shots are not a good way to show example data here, for several reasons. The most useful way, and for your situation, the only usable way, is with 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.

    So please post back using -dataex- to show your example data. The -dataex- output will include the explanation of all those codes, and then concrete advice can be given.

    Comment

    Working...
    X