Hi @FreelanceReinh , @Kurt_Bremser , @LinusH , and @PaigeMiller
Sorry it is totally my typos, so when I edit my data consistently, whether the changed line in the code below is correct, I just wanna cross-check:
Simplistically speaking, yes, I match based on INDC3 and Year.
data winsorize;
input Type $ INDC3 $ Year var1 var2;
cards;
AXX CNSTM 1994 0.01 0.08
MAS CNSTM 1996 0.05 .
RAF CNSTM 1994 0.07 0.08
AGG CNSTM 2004 0.07 .
CCC CNSTM 1996 0.02 .
RBB ENEGY 1998 0.05 0.88
RFB ENEGY 1999 0.06 0.89
TYB ENEGY 2018 0.05 0.48
;
data industry_return;
input INDC3 $ Year var3;
cards;
CNSTM 1988 1.2
CNSTM 1989 1.3
CNSTM 1990 1.5
CNSTM 1994 1.1
CNSTM 1996 1.7
CNSTM 2004 1.9
CNSTM 2018 2.1
ENEGY 1988 3.3
ENEGY 1996 3.5
ENEGY 1998 3.9
ENEGY 1999 4.2
ENEGY 2018 4.4
;
data _wins / view=_wins;
set winsorize;
_seqno=_n_;
run;
proc sql;
create table matching(drop=_seqno) as
select a.*, var3
from _wins a left join industry_return b
on a.indc3 = b.indc3 & a.year=b.year /*changed line*/
order by _seqno;
quit;
Apart from that, I do not know what is the role and purpose of these lines of code in my case???
data _wins / view=_wins;
and
_seqno=_n_;
Warm regards.
... View more