The second row should NOT be removed. because Account_id is not same for both rows.
what i have to do ?
1. i have to compare two rows of data set having same Contact_Objid(not nullable column).
2. if both rows I and J having same Contact_Objid then i have to delete I th row from data set if all other columns of i th rows are having either same value of j th row or Null value.
please give me idea.....how can i implement .....i am thinking about lag function.
is it possible complete all process in one data step...?
comparison between jth and i th row will take place . and one will be deleted. if i th row is subset of jth row then ith will be deleted. else vise versa.
assuming you want just the last of equal groups of contact_objid and account_id, you could use by group processing (even if you need to add the notsorted option)
[pre]data new_data ;
do until( last.contact_objid ) ;
set original ;
by account_id notsorted contact_objid notsorted ;
end ;
run ;[/pre]However, this method depends on having actual Account_id rather than NULL.
how about using two input statements in the datastep to read two rows per iteration and output and not output based on comparison output ?
The 2025 SAS Hackathon Kicks Off on June 11!
Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.