I would suggest that this condition: if week_id= &start_wk then do; doesn't resolve at any point to be true, hence the call symput is not run and ID_START is never defined. The likelihood is that the call: %let startwk =201425; %let endwk =201428; %bci_period(&startwk,&endwk); when looked in combination with the if statement resolves to: if week_id=201425 then do; Which doesn't work. If your sure that week_id is character and contains a value for 201425, then put quotes around the macro variable and retry: if week_id="&start_wk." then do; This should then find a row. However if week_id is numeric then you may need to convert it to the numeric type of week_id, e.g. if put(week_id,yymm6.) = "&start_wk." then do;
... View more