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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 987 views
  • 0 likes
  • 4 in conversation