Announcement

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

  • Label has different values

    Hello everyone, I have a question regarding Stata for my thesis.

    I have 2 seperate datasets that I want to append. All variables append succesfully, accept for one, variable Provincie, which I can't seem to work. This is because "Provincie" has different values. In Dataset 1, if Provincie has value 1 it is Drenthe. 2 = Flevoland, 3 = Zuid-Holland, 4 = Limburg, and so on from 1 to 12 for 12 states of The Netherlands. In Dataset 2, the value for Drenthe is 23, 28 = Flevoland, 25 = Zuid-Holland, 30 = Limburg, and so on from 20 to 31 for the 12 states. Now if I append the Datasets, I get a seperate value for Drenthe (value 1) from dataset 1, and for value as a number of 23 (Drenthe in Dataset 2). What can I do to let Stata know that value 1 and value 23 are both Drenthe, value 4 and 30 both Limburg, etc...

    Thanks in advance!

  • #2
    The problem is clear to me but the intended solution not so much. You could simply recode (or replace) either before or after appending the datasets, e.g.,

    Code:
    recode Province (23 = 1) (28 = 2) ...
    You could also decode the variables in both datasets, append, then encode the appended variables in the combined dataset.

    A more automated solution might require more thinking and typing but might not be worth the effort if this is a one time problem.

    Comment


    • #3
      Click image for larger version

Name:	STATAA.png
Views:	1
Size:	69.7 KB
ID:	1666215
      This is what it looks like after appending. Value "20" is Groningen, value "21" is Friesland, value "22" is Drenthe. How can I merge them so that the 156 numbers of "22" add to the 60 of Drenthe?

      Comment


      • #4
        I didn't see your reply. Thank you I will try that right now!

        Comment


        • #5
          For future questions on Statalist, use dataex to present data examples, not screenshots. It helps others help you. If you have not done so, briefly review the FAQs.

          Comment


          • #6
            Ahh okay, sorry, I will! Your solution works, thank you very much. I have struggled with it for over 4 hours now and you finally brought the solution. Have a nice day!

            Comment

            Working...
            X