Quantcast
Channel: Active questions tagged row - Stack Overflow
Viewing all articles
Browse latest Browse all 447

Count occurences (rows) between dates (SPSS)

$
0
0

I have data on surgeries, every row represent a patient with a performed surgery. I wish to answer the question: How many procedures has this surgeon performed in the last year (at that time of the surgery)?

Here is some example data:

DATA LIST LIST / patient_id (A20) operator_id (A20) procedure_date (SDATE10).BEGIN DATA.1,pseudo_001,2024/02/012,pseudo_002,2024/07/113,pseudo_002,2023/08/104,pseudo_003,2024/03/015,pseudo_004,2024/08/016,pseudo_004,2024/07/027,pseudo_004,2024/01/158,pseudo_003,2023/01/19END DATA.

It is an easy task to create a variable with the date 1 year back:

COMPUTE procedure_date_1yback=DATESUM(procedure_date, -1, "years", 'closest').VARIABLE LEVEL procedure_date_1yback(SCALE).FORMATS procedure_date_1yback(SDATE10).VARIABLE WIDTH procedure_date_1yback(11).EXECUTE.

But from here I am lost. I have managed to get the amount of performed procedures at the "year" before using AGGREGATE on both operator and the "year".

Here is how I would like it to be:

DATA LIST LIST / patient_id (A20) operator_id (A20) procedure_date (SDATE10) performed_procedures (A20).BEGIN DATA.1,pseudo_001,2024/02/01,12,pseudo_002,2024/07/11,23,pseudo_002,2023/08/10,14,pseudo_003,2024/03/01,15,pseudo_004,2024/08/01,36,pseudo_004,2024/07/02,27,pseudo_004,2024/01/15,18,pseudo_003,2023/01/19,1END DATA.

Viewing all articles
Browse latest Browse all 447

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>