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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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