Merging files where errors exist in Log file

#1
hi,

I am executing a specific set of actions as follows from the attached desktop zip files ;

- read in the file Adobe may

1) I am looking at merging the Adobe may file with the NCWeeklyWebinfo_24_40_merge file by Order number as this is the common identifier between the two files
2) then I wish to summarize the data so I can get a view on number of New Customer counts (New|Existing) by Order date and Last Touch channel.

The following are the steps of code, I can;t seem to get over the initial hurdle as the log file throws up an error with the BY statement when sorting by Order number.
Q1. How can I tidy up the data or fix the error in my code to achieve the summaries in my code?

thanks :tup:

CODE:

data Adobe_may (where=(Order_number ne ''));
infile "C:\Users\ahart\Desktop\New Cust Marketing Channel\Adobe\Adobe may.csv"
dsd dlm = ',' truncover lrecl = 1023 firstobs = 2;

input Order_number :$150.
Last_Touch_Channel :$150.
New_status_Adobe :$100.
Revenue_Pre_Cart_Discount :best20.
Cart_Discount :best20.
Product_Discount :best20.
Delivery_Charges :best20. ;


format Order_number :$150.
Last_Touch_Channel :$150.
New_status_Adobe :$100.
Revenue_Pre_Cart_Discount :best20.
Cart_Discount :best20.
Product_Discount :best20.
Delivery_Charges :best20. ;

run;


THEN


data second_merge;
merge NCWeeklyWebinfo_24_40_merge Adobe_may;
by Order_number;

run;

THEN

data Summary_Base;
set second_merge;
where (Order_Date ~= .);
run;


proc means data = Summary_Base noprint;
class Order_Date
new_status;
var OrderRevenue
Units
Orders;
output out = Summary_by_Week
sum(OrderRevenue) = OrderRevenue
sum(Units) = Units
sum(Orders) = Orders;
run;


data Summary_by_Week;
drop _TYPE_;
rename _FREQ_ = Count;
set Summary_by_Week;
where (_TYPE_ = 3);
run;


/*Customer counts for unique email address*/

proc sql;
create table NewCustomercount as
Select

Order_Date,
COUNT(DISTINCT Case When new_status='new' then EmailAddress end) as New,
COUNT(DISTINCT Case When new_status='existing' then EmailAddress end) as Existing

From Summary_Base

Group by
Order_Date
Last_Touch_Channel ;
quit;