Announcement

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

  • Force Merge

    Hi, I am trying to merge household-level data for two different rounds but I keep on getting an error. I have attached the STATA code and the error.

    Command: merge m:1 STATEID DISTID PSUID HHID2005 HHSPLITID2005 using "C:\Users\Hammu\Desktop\Merging by including yea r variable\2012 data\Round2HH.dta"

    Error: variable IDHH is long in master but str10 in using data. You could specify merge's force option to ignore this numeric/string mismatch. The using variable would then be treated as if it contained numeric missing value.

  • #2
    In your primary dataset the variable IDHH has apparently been stored as a numeric variable. This could be good or it could be bad. If destring was used to create a numeric variable IDHH from a string variable, then you should be able to do the same thing in your secondary dataset. But if the numeric IDHH was created with encode then you have a problem, because the codes created won't be the same as the labels display.

    To better diagnose your problem, run
    Code:
    dataex IDHH in 1/10
    in both your primary and secondary datasets and post the results from each. Then you can get an answer specific to your actual data.

    Comment


    • #3
      to add to William Lisowski 's answer, you might want to download (from SJ; use -search- to find and download) the following command: precombine; this does a very good check in advance for you (Stata, as you saw, does checks, but it stops with an error message each time it finds a problem; -precombine- will give you a more comprehensive report

      Comment

      Working...
      X