05-31-2017 05:48 AM
Would be glad if someone could help me with my problem.
I want to create one more column where I flag customers from other existing columns.
Can somebody please help me with that code?
In column A I have "MOTHERCUST_ID", in column B I have "CUST_ID" and in column C I have "ORG_NR".
The code I want will give me:
If one "MOTHERCUST_ID" (column A) have one or more "CUST_ID" (column B), and all have the same "ORG_NR" (column C) as the mother - they should all get "TRUE" in column D.
If one "MOTHERCUST_ID" (column A) have more than one "CUST_ID" (column B), and one or all have different "ORG_NR" (column C) than the mother - they should all get "FALSE" in column D. -Even if one of the customer have the same orgnr and the rest is wrong, they should all get "FALSE".
*See how I want the result in new column in the attach file, marked with different colors.
Black is customer who have only one row per customer
Red is group-customer who have more than one customer connected, but all with same org-number.
Green is group-customer who have more than one customer connected, where one or all org-number is different than the mother.
05-31-2017 05:53 AM
It's great that you've posted the desired output.
Please provide also sample source data (a SAS data step creating such data) so we can post working and tested code. Posting such code is much simpler and clearer than trying to explain to you verbally what needs to be done.
05-31-2017 06:13 AM
We cannot see what your data looks like, therefore need to re-create it, follow this post:
05-31-2017 06:17 AM - edited 05-31-2017 06:18 AM
The only thing I'm asking for is that you post a SAS data step which creates for us sample data.
data have; infile datalines dsd dlm=',' truncover; input mothercust_id cust_id org_nr; datalines; 1,11,1234 2,22,1235
...all the other observations as shown in your screen shot ; run;
If you've got already a SAS data set then you can also use the link @RW9 posted to create such a SAS data step