- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm doing a data step scenario to show telephone_uid (tel_number in data step code) with more than 1 unique full_name.
Here is my data step code:
I need an advice on how to correct my code to show only those tel_number with more than 1 full_name associated on it.
Thank you.
Regards,
Adrian
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Below code should work but is untested because you didn't provide sample data in a usable format.
proc sort
data=&input_dataset(keep=tel_number full_name)
out=intermediate
nodupkey;
by tel_number full_name;
run;
data &output_dataset;
set intermediate;
by tel_number;
if first.tel_number then name_count=1;
else name_count+1;
if last.tel_number and name_count>1 then
do;
&message=catx(' ','Telephone : ',tel_number,'Suspicious.... to', name_count,'people...');
....
output;
end;
run;
For future questions please post your data and code as text and not as screenshots. Use icons
to do so.
Would you have been happy if I'd posted my reply as picture?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Below code should work but is untested because you didn't provide sample data in a usable format.
proc sort
data=&input_dataset(keep=tel_number full_name)
out=intermediate
nodupkey;
by tel_number full_name;
run;
data &output_dataset;
set intermediate;
by tel_number;
if first.tel_number then name_count=1;
else name_count+1;
if last.tel_number and name_count>1 then
do;
&message=catx(' ','Telephone : ',tel_number,'Suspicious.... to', name_count,'people...');
....
output;
end;
run;
For future questions please post your data and code as text and not as screenshots. Use icons
to do so.
Would you have been happy if I'd posted my reply as picture?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content