05-26-2016 10:14 PM
I want to know how many times a by group occured in a table and write that on a separate dataset (has to be a character number as I am concatenating with character as well). Can someone help please.
input Student_ID $ Course_ID $ Score;
M101 Eng 20
M101 Bio 20
M101 Eng 10
M101 Math 18
F103 Bio 18
F103 Math 99
F103 Eng 16
F103 Che 15
F103 Math 20
F103 Phy 17
line='Totalcount'||Number of M101 by group occurance in have table||Number of F103 by group occurance in have table;
05-26-2016 10:31 PM
Probably many ways to skin this cat ...
length line $ 16;
retain line 'Totalcount';
do until (last.Student_ID);
set have end=done;
count + 1;
line = cats(line, put(count, z3.));
It's untested, but definitely headed in the right direction.
Are you sure you don't want to keep Student_ID as part of the output line?
05-27-2016 01:40 PM
05-26-2016 10:50 PM
That doesn't make sense, how would you parse the numbers back out.
Wouldn't you at least want a delimiter between the counts? Or a standard format, ie 8 digits?
Are you assuming the Z3 format, so no counts greater than 999?