BookmarkSubscribeRSS Feed
venkatard
Calcite | Level 5

course        class          user             score            post     forum      quiz             assign     main         group  

1001200130010100000
1001200230010000000
1001200130010000000
1001200230015000000

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

5 REPLIES 5
LinusH
Tourmaline | Level 20

sql: select max(score)...?

Data never sleeps
venkatard
Calcite | Level 5

Sorry for the confusion it is row and not column

LinusH
Tourmaline | Level 20

sum(score, post...)

Data never sleeps
esjackso
Quartz | Level 8

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

ChrisNZ
Tourmaline | Level 20

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.

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
  • 5 replies
  • 854 views
  • 0 likes
  • 4 in conversation