Each row is a therapy session by a variable label ID. Each unique ID has between 1 and 50 rows in SPSS (sessions). How can I select only those unique IDs with 3 or more sessions?
Hi you need to do: tab Data --> Select case, click on IF apply your condition select your variable "Number of sessions" >= 3. To check, in data view crosse on rows excluded or tab Analysis --> Descriptive Statistics --> Frequencies put the variable check uniques levels is above 3 for the number of sessions.
Thank you sincerely for your response. The issue is that I don't have a variable of "Number of sessions". I have multiple rows (sessions) with the same ID number. I can view how many rows/sessions I have for each unique participant ID with the frequencies function, but I am struggling with how to retain and filter unique ID that have at least 3 rows/sessions.
Maybe try to do a descriptive stative frequency on the variable ID. In this case, you will have for each ID, the number of session. After you can generate a new table with unique ID. After to combine unique level, in my study, the only way i find it it is to use the a program language software R, I entered my dataset and the table with identifier I want keep and I matching it to select only row I wanted. To be honest, I am not sure if we can similar things on SPSS. The code is not long i can share you an example.
You do not even have to sort the cases by 'ID' beforehand (although that used to be necessary, but not anymore). Sorting by 'ID' is nevertheless probably a nice thing to do anyway, so if the records are not already grouped by 'ID', you can do:
sort cases by ID.
You can use the new variable 'Number_of_sessions' like any other variable, for instance to select the records you need (3 or more sessions):
select if Number_of_sessions>=3.
Or use it for filtering purposes, if you do not want a 'permanent' selection. Instead of filtering, you can also opt for a temporary selection, which is only active for the next procedure (frequencies, correlation, regression, anova, or whatever). For example:
So, open that syntax window, type 'aggregate etc.' (or copy/paste it) and... run! If you want to know the ins and outs of 'aggregate', place the cursor on the word 'aggregate' in the syntax (anywhere on that line actually), and press the function-key 'F1' on your keyboard. Note that these kinds of operations are much easier to accomplish with one or two syntax-lines (which you can save for later references and/or re-use) than with the menu's.