SAS merging with no common variable

纵然是瞬间 提交于 2019-12-13 10:25:32

问题


I need to merge two data sets that have no common variable, and only one variable apiece. One data set is about 200 lines of unique values and the other is 80,000 unique lines. I have tried the common merges, but cannot get what I'm looking for. The following is what I'm after:

Set a variables: x y

Set b variables: 1 2 3

Desired merged data sets result (2 columns):

x 1
x 2
x 3
y 1
y 2
y 3

Thanks for any insight.


回答1:


From my understanding of your question, it seems like you're trying to do a many to many merge. Try a proc sql cross join/cartesian product:

proc sql;
create table want as
select
*
from have1, have2;
quit;


来源:https://stackoverflow.com/questions/24072216/sas-merging-with-no-common-variable

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!