Original Message:
Sent: Fri June 14, 2024 03:01 PM
From: Art Jack
Subject: Select and Filter by Cases Based on Frequency
i think something simple like this would work.
if appoint_type=1 flag=1.
recode flag(missing=0).
aggregate outfile =* /break id flag /count=n.
or
aggregate outfile =* /break id appoint_type /count=n.
------------------------------
Art Jack
Original Message:
Sent: Fri June 14, 2024 11:48 AM
From: Colter Clayton
Subject: Select and Filter by Cases Based on Frequency
This works perfectly, thank you! Also, how would I add to break with an additional variable? So, I have my 'ID' variable and I have an 'appoint_type' variable that has values from 1 to 5. If I want to break by 'ID' and 'appoint_type' when 'appoint_type' is equal to 1, how would I properly add that to the syntax? For example,
AGGREGATE OUTFILE=* mode=ADDVARIABLES /BREAK=id and appoint_type=1 /count=n.
Additional syntax added in italics
------------------------------
Colter
Original Message:
Sent: Fri June 14, 2024 09:00 AM
From: Art Jack
Subject: Select and Filter by Cases Based on Frequency
i'd use addvariables in the aggregate.
AGGREGATE OUTFILE=* mode=ADDVARIABLES /BREAK=id /count=n.
------------------------------
Art Jack
Original Message:
Sent: Wed June 12, 2024 01:29 PM
From: Colter Clayton
Subject: Select and Filter by Cases Based on Frequency
Hello All, first time here.
I want to select cases (rows) based on the frequency of a numerical value in a variable column, which are unique IDs. However, each ID may have 1 to 50 sessions, with each session listed as an individual row.
Variable Column: ID
Rows: Individual sessions.
Essentially, I am looking for something like this, but I haven't gotten anything to work.
Compute if frequency of 'ID' is greater than 2 as '1' or else '0' to new variable called 'enough_sessions'. '1' would mean 'yes' enough sessions. Then,
I would add 'enough_sessions = 1' and be able to perform other analyses on just those participant IDs with at least three sessions.
Any tips? Thank you!!!
Colter
------------------------------
Colter Clayton
------------------------------