06-16-2016 04:38 AM
i am using the below code to display and count distinct subjects but i get the same number for all 3 reportings.
create table inc as
select distinct reporting, product, comparator, comparator2, randomisation_scheme,
"All Subjects" as txt,count(distinct subj_id) as cnt
order by trl_id_reporting;
Can anyone help me on this
06-16-2016 04:43 AM
To do aggregates in SQL you use the keywords;
Also your code will not work, you are refering to variables that are not in the select clause, maybe you want: something like the below - its hard to say as you have not posted any test data (in the form of a datastep) and what the output should look like, so we are guessing.
proc sql; create table INC as select REPORTING, PRODUCT, COMPARATOR, COMPARATOR2, RANDOMISATION_SCHEME, "All Subjects" as TXT, count(distinct SUBJ_ID) as CNT from SUBJ group by REPORTING, PRODUCT, COMPARATOR, COMPARATOR2, RANDOMISATION_SCHEME, "All Subjects"; quit;
06-16-2016 04:49 AM
Sorry, I have no idea what your talking about. Post test data - in the form of a datastep - and what the output should look like.
06-16-2016 04:58 AM
Need further help from the community? Please ask a new question.