我有 2 个表,T1 包含 10 个变量和 T2。包含 100 个变量。我必须通过将 T1 10 个变量乘以 T2 的相同 10 个变量(仅姓氏更改)来求和。我想将变量名称保持在循环中并输出为 TOTAL_。
例如:应用程序将替换为:store、ramp、abhi、coast、recyc、ind 等。
proc sql;
create table OHDT as
select T2.Model,T2.Age,
sum( T1.Com_Pass * T2.Com_Pass_app
,T1.Com_Frt * T2.Com_Frt_app
,T1.Com_Other * T2.Com_Other_app
,T1.BG_Corp * T2.BG_Corp_app
,T1.BG_Fract * T2.BG_Fract_app
,T1.BG_Gov * T2.BG_Gov_app
,T1.BG_Other * T2.BG_Other_app
,T1.BG_Owner * T2.BG_Owner_app
,T1.BG_Part * T2.BG_Part_app
,T1.mil_Agri * T2.mil_Agri_app ) as Total_app,
from Market T1
inner join master T2
on
T1.Model= T2.Model and T1.Age=T2.Age;
quit;