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0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 run; data notrelatedmatch; merge related1st(in=in1) related2st(in=in2); length find $15; by id; if in1 and not in2 then find='not_matched1'; else if not in1 and in2 then find='not_matched2';
Hello team,
How to exclude all variables that begin with “Cu” from notrelatedmatch?
Regards,
blueblue
Yes, you can use a list of variables next to DROP=
Please go back to your ORIGINAL post in this thread and modify the title to indicate you want to remove variables in a MERGE, so that the title reflects the actual subject of the post.
How to exclude all variables that begin with “Cu” from notrelatedmatch?
On the one hand, you ask about removing variables, but your title talks about WHERE clause which removes observations. So which is it? Do you want to remove variables or observations?
Hello Diamond,
I am talking about variables.
I used drop statement:
data notrelatedmatch(drop=cust:);
I got what I wanted. I wonder if we can use a list variable in where clause with not.
Please advise me.
Regards,
blueblue
Yes, you can use a list of variables next to DROP=
Please go back to your ORIGINAL post in this thread and modify the title to indicate you want to remove variables in a MERGE, so that the title reflects the actual subject of the post.
@GN0001 wrote:
Hello Diamond,
I am talking about variables.
I used drop statement:
data notrelatedmatch(drop=cust:);I got what I wanted. I wonder if we can use a list variable in where clause with not.
Please advise me.
Regards,
blueblue
You will have to show the exact where clause you intend to use. Hit or miss whether you guess right. Most value comparisons likely don' t us a list the way you expect, especially if want to compare multiple variables and multiple values.
Please help everyone by editing the title of the ORIGINAL post to indicate that the question is not about WHERE clauses but it is about DROP= lists.
@GN0001 wrote:
Hello,
I did it in the original post.
Regards,
blueblue
I don't think you did, it still says "WHERE clause ..."
Drop cu: ;
If you don't want them why bother keeping them through the merge??? Use data set options to Keep=ID as that is the only other variable you show.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.