1.如果通过合并要加入的新数据所表示的变量在原表中有,这个时候普通的merge合并后,在显示这个变量的值的时候会按照原表的数据显示。比如原表里变量a的值有一部分显示缺失,一部分有数值,要把另一个表中变量a的值插入到原表中缺失的地方,普通merge合并后原表缺失处还是缺失的。这个时候应该在命令后加入update或replace。具体见帮助里merge部分的解释:
update and replace both perform an update merge rather than a standard merge. In a standard merge, the data in the master are the authority and inviolable. For example, if the master and using datasets both contain a variable age, then matched observations will contain values from the master dataset, while unmatched observations will contain values from their respective datasets.
If update is specified, then matched observations will update missing values from the master dataset with values from the using dataset. Nonmissing values in the master dataset will be unchanged.
If replace is specified, then matched observations will contain values from the using dataset, unless the value in the using dataset is missing.
2.可能是代码书写错误。
3.可能是要匹配的变量在两个表中的存储格式不同导致merge失败。
4.也可能是其他原因,可以参看软件结果窗口给的报错的内容。