首先纠正你一个问题,"Key variables cannot be strLs" 这里的strLs是指长字符,长字符的概念是Stata 13里才出现的,你的cusip只是一般string,不是长字符,merge用一般string匹配没有问题。
其次,如果你认真读了help文档的话,有这么一句话"Use of merge m:m is not encouraged."应该说,merge m:m应该尽量避免,如果真有这种需求,最好通过joinby实现。
你做1:1匹配的时候,"variable cusip does not uniquely identify observations in the master data"说明你master的数据对于cusip year组合有重复值。另外,不知道你using数据有没有重复值,你自己要再确认一下。你可以用duplicates命令处理重复值的问题。
你需要明白你的重复值是如何产生的,是需要保存的,还是需要删除的,这个决定了你要用merge还是joinby。
另外,你查一下你的cusip,cusip在许多数据库是6位的代码,在有的数据库是8位代码,8位cusip的前6位和6位cusip是一致的。你显示的cusip有7位有8位,这里肯定有问题。


雷达卡





京公网安备 11010802022788号







