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;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.