DATA Step, Macro, Functions and more

base sas

Reply
Contributor
Posts: 53

base sas

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
Frequent Contributor
Posts: 95

Re: base sas

Posted in reply to rajeshalwayswel

What code have you written?

Norman.
SAS 9.4 (TS1M4) X64_7PRO WIN 6.1.7601 Service Pack 1 Workstation

Contributor
Posts: 53

Re: base sas

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
Frequent Contributor
Posts: 95

Re: base sas

Posted in reply to rajeshalwayswel

What happens when you run this program?

Norman.
SAS 9.4 (TS1M4) X64_7PRO WIN 6.1.7601 Service Pack 1 Workstation

Contributor
Posts: 53

Re: base sas

Required output for the above question is need only three observations from the seven observations...
Super User
Posts: 7,868

Re: base sas

Posted in reply to rajeshalwayswel
Show the code you tried to get your result, and tell us the logical rule behind it.
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 53

Re: base sas

Posted in reply to KurtBremser
for a subject to find the maximum count from each column...
Super User
Posts: 5,518

Re: base sas

Posted in reply to rajeshalwayswel

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;

Contributor
Posts: 53

Re: base sas

Posted in reply to Astounding
great...I'm trying same in proc sql I'll send it...
Ask a Question
Discussion stats
  • 8 replies
  • 153 views
  • 0 likes
  • 4 in conversation