course class user score post forum quiz assign main group
1001 | 2001 | 3001 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
1001 | 2002 | 3001 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1001 | 2001 | 3001 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1001 | 2002 | 3001 | 5 | 0 | 0 | 0 | 0 | 0 | 0 |
In this example if we see the third and fourth column has all zeros. i want to know which row has all zeros and which has atleast one value.
Any help please
sql: select max(score)...?
Sorry for the confusion it is row and not column
sum(score, post...)
Here is a simple flagging in a dataset. If you just want a dataset of the ids you could just keep those variables.
data out;
set in;
flag = 1 + sum(score, post, forum, quiz, assign, main, group);
if flag = 1 then output;
run;
If you want to just produce a report you could use sql;
Proc sql;
select course, class, user
(1 + score + post + forum + quiz + assign + main + group ) as flag
from in
where calculated flag = 1
;
quit;
Just some thoughts, hope it helps!
EJ
FOUND_VALUE_FLAG=sum(of SCORE--GROUP) ne 0;
provided the values can only be positive.
Otherwise something like
FOUND_VALUE_FLAG=lengthn(compress(cats(of SCORE--GROUP),'0.')) ne 0;
will take care of any real number.
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.
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.