Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
577 views
in Technique[技术] by (71.8m points)

macros - proc sql宏联接多个表(proc sql macro join multiple tables)

I have multiple tables called var1, var2, var3 and want to join them to my table new1.

(我有多个名为var1,var2,var3的表,并希望将它们加入到我的表new1中。)

I would like something like the code below so that I can specify the number of var tables.

(我想要类似以下代码的内容,以便可以指定var表的数量。)

Any help to get the something working in the format below will be great.

(以下面的格式进行操作的任何帮助都将非常有用。)

%macro sqlloop(start,end); 
   PROC SQL; 
     %DO tab_=&start. %TO &end.; 
       CREATE TABLE fin as 
       SELECT * FROM new1 a join varx&tab_. b
                            on a.obs=b.obs; 
     %END; 
   QUIT;
%mend; 

%sqlloop(start=1, end=3)
  ask by S Kohli translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...