BookmarkSubscribeRSS Feed
rajeshalwayswel
Pyrite | Level 9
data have; usubjid col1 col2 col3; cards; 001 1 0 0 001 0 0 1 002 1 0 0 002 0 0 1 003 1 0 0 003 0 1 0 003 0 0 1 run; Required output: usubjid col1 col2 col3 001 1 0 1 002 1 0 1 003 1 1 1
8 REPLIES 8
Norman21
Lapis Lazuli | Level 10

What code have you written?

Norman.
SAS 9.4 (TS1M6) X64_10PRO WIN 10.0.17763 Workstation

rajeshalwayswel
Pyrite | Level 9
data have;
input usubjid col1 col2 col3;
cards;
001 1 0 0
001 0 0 1
002 1 0 0
002 0 0 1
003 1 0 0
003 0 1 0
003 0 0 1
run;
Required output:
usubjid col1 col2 col3
001 1 0 1
002 1 0 1
003 1 1 1
Norman21
Lapis Lazuli | Level 10

What happens when you run this program?

Norman.
SAS 9.4 (TS1M6) X64_10PRO WIN 10.0.17763 Workstation

rajeshalwayswel
Pyrite | Level 9
Required output for the above question is need only three observations from the seven observations...
rajeshalwayswel
Pyrite | Level 9
for a subject to find the maximum count from each column...
Astounding
PROC Star

Here's one way to proceed:

 

proc summary data=have nway;

   var col1 col2 col3;

   class usubjid;

   output out=want (drop=_type_ _freq_) max=;

run;

rajeshalwayswel
Pyrite | Level 9
great...I'm trying same in proc sql I'll send it...

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 2259 views
  • 0 likes
  • 4 in conversation