libname bci "/department/gld/uk/shahha03"; libname pdlref "/department/gld/uk/HK_MANNINGS_DC/pdl/ref/" ; %macro bci_period(start_wk,end_wk); data _null_; set pdlref.time_cycle; if week_id= &start_wk then do; call symput("id_start",time_pd); end; if week_id = &end_wk then do; call symput("id_end",time_pd); end; run; %put &id_start &id_end; %put &id_start &id_end; data _null_; set pdlref.time_cycle; format week_id_end yymmddn8.; id_end1 = &id_end+1; do i = &id_start to &id_end; id_end1 = id_end1 -1; if time_pd = id_end1 then do; call symput(cat('wkno',i),week_id); call symput (cat('wkedno',i),PUT(week_id_end,YYMMDDn8.)); end; end; run; %mend; %macro bci_mnn; %do i = &id_start %to &id_end; %let wk=&&wkno&i; %let wk1 =&&wkedno&i; %put &wk1; %let fileloc=/department/gld/uk/HK_MANNINGS_DC/rawdata/input/wk&&wk/original; filename bci_mnn PIPE "zcat &fileloc./bci_mnn_&wk1.000000.dat.gz"; /*%let wk2 = cat('bci_mnn_',&wk1,'000000');*/ data work.bci_mnn_&wk (compress=yes); length retailer_basket_id $ 9 retailer_store_number $ 6 retailer_loyalty_card_id $ 13 retailer_coupon_id $ 13 retailer_promotion_id $ 6 time_key $ 8 member_group_code $ 17 member_group_code_type $ 1 coupon_printed $ 1 ; infile bci_mnn dsd missover dlm='|' end=eof; /*infile "&fileloc./bci_mnn_&wk1.000000.dat" dsd missover dlm='|' end=eof;*/ input retailer_basket_id $ retailer_store_number $ retailer_loyalty_card_id $ retailer_coupon_id $ retailer_promotion_id $ time_key $ member_group_code $ member_group_code_type $ coupon_printed $ ; week_id = &wk; run; proc sql noprint; create table bci.BCI_MNN_&wk as select bsk.*,cust.retailer_household_id from work.bci_mnn_&wk as bsk left join pdlref.customer as cust on bsk.retailer_loyalty_card_id = cust.retailer_identifying_card_id; quit; %end; %mend; %macro bci_yyyyww; %let startwk =201425; %let endwk =201428; %bci_period(&startwk,&endwk); %bci_mnn; %mend; %bci_yyyyww; WARNING: Apparent symbolic reference ID_START not resolved. ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &id_start ERROR: The %FROM value of the %DO I loop is invalid. WARNING: Apparent symbolic reference ID_END not resolved. ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &id_end ERROR: The %TO value of the %DO I loop is invalid. ERROR: The macro BCI_MNN will stop executing. While I apply macro variable inside %macro bci_period(start_wk,end_wk); %bci_mnn; %mend; Program running fine and resolve this issue..can anyone says why call symput (ID_start & ID_end) value may not able to resolve...my question here if I created loop macro variable using call symput which is easily coming during the program even though did not modify any syntax..
... View more