cancel
Turn on suggestions
Showing results for
Search instead for
Did you mean:
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Obsidian | Level 7

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.

Screenshot 2022年03月29日 234340.jpg Here is my data step code:

Screenshot 2022年03月29日 234620.jpg

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

0 Likes
1 ACCEPTED SOLUTION

Accepted Solutions
Opal | Level 21

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

[画像:Patrick_0-1648583285463.png]

to do so.

Would you have been happy if I'd posted my reply as picture?

[画像:Patrick_1-1648583331312.png]

2 REPLIES 2
Opal | Level 21

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

[画像:Patrick_0-1648583285463.png]

to do so.

Would you have been happy if I'd posted my reply as picture?

[画像:Patrick_1-1648583331312.png]

Obsidian | Level 7

Thanks for the reminder @Patrick and thanks for the answer.

Regards,

Adrian

0 Likes

sasinnovate.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just 495ドル!

Register now

Call for Content EXTENDED

Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.

Submit your proposal!

Discussion stats
  • 2 replies
  • ‎03-29-2022 11:48 AM
  • 6024 views
  • 1 like
  • 2 in conversation
[フレーム]

AltStyle によって変換されたページ (->オリジナル) /