BookmarkSubscribeRSS Feed
lone0708
Fluorite | Level 6

Dear All,

Hope you can help me move on.

I am working with a dataset where people have measurements at predefined timepoints. Not all persons have measurements at all timepoints, and it is random which timepoints they appear in.

I want to count how many people have a measurement in timepoint 1,2,3 etc, but also combined so how many have measurements in 1 and 2 and 3.

 

I have used this code to get a nice overview of which timepoints they appear in:

 

proc report data=have;

   columns id timepoint ;

   define id /group;

   define timepoint/ across;

run;

 

My question is, is there a code to summarize the findings from the above? Especially the combined version with measurements in both 1 and 2 and 3 .

 

Thanks

3 REPLIES 3
Kurt_Bremser
Super User
proc sql;
create table want1 as
  select
    timepoint,
    count(*) as count_per_timepoint
  from have
  group by timepoint
;
create table want2 as
  select
    count(*)
    from (
      select personid
      from have
      having count(*) = 3
    )
;
quit;

Untested; please supply usable example data so we can test our code suggestions.

lone0708
Fluorite | Level 6

Hi Kurtbremser,

Thanks for you reply.

Does the attached file help?

 

The first part of the code worked to get me an overview of how many in each time point, but not how many who have continuous/complete data from all/part of timepoints.

the second part did not work on my dataset. 

 

 

Kurt_Bremser
Super User

"Usable example data": something I copy/paste to my program editor and submit, which then creates the dataset; usually a data step with datalines. Also show an example of the expected outcome from that particular input data.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 970 views
  • 0 likes
  • 2 in conversation