Hi,
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.
JI
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.
I´m not sure what you mean here?
I thougt maybe that I could write some kind of code or an expression that should give me what I needed.
We cannot see what your data looks like, therefore need to re-create it, follow this post:
The only thing I'm asking for is that you post a SAS data step which creates for us sample data.
Something like:
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
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.