Hi,
I need some logic to carry out the following requirements if possible please.
My current table (New_Orders) has the following variables
Name
REF
Last Name
Order
Region
Status
TelNo
Login_id
What I need is to create 2 new variables within this table called
'New_Order'
and
'Curr_User'
Requirements
New Variable 'New_Order' = if Login_ID is in table New_Orders and New_Orders_Prev_Month then 'Existing' else 'N/A'
New Variable 'Curr_User' = if Email is in table New_Orders and New_Orders_Prev_Month then '1' else 'N/A'
Thanks
Can you describe your problem with some sample data and what you want the result to look like from that data? Makes it much easier to provide a usable code answer.
What I am trying to understand is how many existing customers do we have (these will be captured within previous months table) that have made a new order vs newly on boarded customers (that won't exist in the previous months table).
Ok. How big is your data?
Repeating what @PeterClemmensen already said: please post data showing what you have and what you expect as result. From the description it seems that you need a simple merge with some logic to mark those customers not already in the previous month table.
I can't see your data, so needless to say, this is untested
data New_Orders_1;
if _N_=1 then do;
declare hash h(dataset:'New_Orders_Prev_Month');
h.definekey('Login_id');
h.definedone();
end;
set New_Orders;
if h.check()=0 then New_Order='Existing';
else New_Order='N/A';
run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.