I am trying to create a data set using SQL in which the count is grouped by another variable. It happens that no record meet the criteria, so I expect it to bring back zero by the group variable. For some reasons, I keep on getting zero rows.
For example, suppose my data is like this:
input id a b trtpn;
1 2 4 1
2 3 5 1
3 4 0 2
4 5 1 2
4 2 1 3
3 3 4 3
3 5 7 3
proc sql noprint;
create table want as
select trtpn,count(distinct id) as count
group by trtpn;
If it's correct ,the output should look like the following:
Any help is appreciated.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.