Hello Experts,
Do you know please, how to write the proc sql count distinct statement with condition to have this output :
Input :
Output :
Thank you !
UNTESTED CODE
proc sql;
create table want as select count(*) from have group by week,data;
quit;
If you want tested code, please provide the data as text as SAS data step code (instructions) and not as screen captures.
You can also do this via PROC FREQ
proc freq data=have;
tables week*data/nocol norow nopercent;
run;
Please do never (as in NEVER) supply example data in pictures. Always (as in ALWAYS) use a data step with datalines, posted in a code box.
Because of the lack of usable data, this code is untested:
proc report data=have;
column week n,data;
define week / group;
define data / "" across;
define n / "";
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: