You might want to do some reading of how SAS works. There are a few good SAS books in the market as well as the SAS Online Doc (the SAS Concepts would be a start).
Have a look at below code. May be this will answer your question.
data t1;
input id t1_value;
datalines;
1 10
2 55
3 8
;
run;
data t2;
input id t2_value;
datalines;
1 2
2 5
4 100
;
run;
data t3;
merge t1 t2;
by id;
if t2_value ne 0 then
t3_value=t1_value/t2_value;
run;
data t1 ;
input id a b c ;
cards;
1 4 5 8
2 8 3 1
3 6 2 11
;
run;
data t2 ;
input id a b c ;
cards;
1 14 35 48
2 28 3 41
3 16 42 11
;
run;
proc SQL ;
create table t3 AS
select t1.id as id, t1.a/t2.a format=8.5 AS a , t1.b/t2.b AS b , t1.c/t2.c AS c
from t1 as t1, t2 as t2
where t1.id=t2.id ;
quit ;
run ;
Do these two dataset (T1 T2) have the same names?
if has the same name ,you need to rename them.
[pre]
proc sql feedback;
select name from dictionary.columns where libname=upcase("&libname") and memname=upcase("&right_dsn");
select name
into : name1 - : name&sqlobs.
from dictionary.columns where libname=upcase("&libname") and memname=upcase("&right_dsn");
quit;
proc datasets library=&libname memtype=data nolist;
modify &right_dsn;
rename %do i=1 %to &sqlobs;
&&name&i = _&&name&i
%end;
;
quit;
[/pre]
If not ,can make a merge by variable by using 'count+1';
[pre]
data t1;
input ....
count+1;
run;
data t2;
input ....
count+1;
run;