In my original code, I want to merge several data bases:
%let theft=1;
proc sql;
create table NewTable as
Select *
From
dtm_sitecom.FactSitecAllCriteria SITEC
left join dtm_sitecom.FactClaimLastVersion FactClaimLastVersion
on FactClaimLastVersion.ClaimId = Sitec.ClaimId
/*Condition 1 here*/
/*If &Theft=1 then*/
left join dtm_sitecom.DimClaimState DimClaimState
on DimClaimState.ClaimStateKey = FactClaimLastVersion.ClaimStateKey
/*Condition 2 here*/
/*else if &Theft = 0 then*/
left JOIN dtm_sitecom.DimGeoRisk dgr
ON dgr.GeoRiskKey = SITEC.GeoRiskKey;
quit;
On the upgraded version, I want to add some conditions (/Condition 1/ and /Condition 2/ in the code) such as, if the value of the variable Theft=1
then do the merge with the talbe dtm_sitecom.DimClaimState
, otherwise do the merge with the other table. I tried the code as if there is no comment sign around the if
, but it didn't work because of the wrong syntax. Is there any SAS syntax allowing me to do that?
on
clause is a condition, so what kind of condition are you trying to add that's not going to work there? – Joetheft=0
could you have any successful matches inDimClaimState
? Or are those only going to match whentheft=1
? – JoeTheft
is just a variable assigned by%let theft=1;
. So that in the begining of the program I can control which data to be merged, i.e I could have any sucessful matches. – Metariattheft
is a macro variable? – Joe