Hi, I'm trying to write a code to skip a block of syntax if i=5 or 6 in a do loop but I find that it is not working as intended. Only the %skip label ends up running and either overwrites the datasets from the first block of code or perhaps the first block of code is getting ignored for some reason. Anyone have tips for troubleshooting? Using SAS 9.4 %macro link; %do i=1 %to 9; %if &i=5 or &i=6 %then %goto skip; proc sql noprint; create table link_dth&i as select a.DTHID&i, a.year as DTH_YEAR, a.UID4S&i as DTH_UID4S&i, b.UID4S&i as PMP_UID4S&i, b.SEQ as SEQ, b.year as PMP_YEAR from in.cleanall_test_UID4S&i as a, pmp.cleanall_test_UID4S&i as b where a.UID4S&i=b.UID4S&i; quit; %skip: proc sql noprint; /*Link PMP with SPARCS 5,6*/ create table link_dth&i as select a.DTHID&i, a.year as DTH_YEAR, a.UID4S&i as DTH_UID4S&i, a.gender_DTH as DTH_GENDER, b.UID4S&i as PMP_UID4S&i, b.SEQ as SEQ, b.year as PMP_YEAR, b.gender_PMP as PMP_GENDER from in.cleanall_test_UID4S&i as a, pmp.cleanall_test_UID4S&i as b where a.UID4S&i=b.UID4S&i and a.gender_DTH=b.gender_PMP; quit; %end; %mend;
... View more