I ran the two pieces of code below and they give me different outputs.
When I execute Code A when it starts processing data from the second table the first observation calculates the variable 'customer_id' correctly, however subsequent observations results in the 'customer_id' being retained for all remaining observations.
Code B produces values for customer_id_3 as I'd expect without retaining values.
Is there a fundamental reason why Code A retains values for the second table however code B does not? Thanks in advance!
/* Code A */
data acc_cust_match_test;
set table1 (keep= customer_id)
table2 (keep= customer_id rename=(customer_id = customer_id_2));
if customer_id = '' then customer_id = '000'||substr(customer_id_2,4);
run;
/* Code B */
data acc_cust_match_test2;
set table1 (keep= customer_id probeacctnumber)
table2 (keep= customer_id rename=(customer_id = customer_id_2));
length customer_id3 $20.;
if customer_id = '' then customer_id_3 = '000'||substr(customer_id_2,4);else
customer_id_3 = customer_id;
run;
Note: all customer_id variables and variants are character variables of length 20.
... View more