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...

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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