Help with substracting conditional variable frequencies

Hi all!
I hope someone can help me with this problem:

The goal is to substract how many subjects state what reason they have for discontinuation of antidepressant medication (options: no effect, symptoms have cleared, experience side effects).

This is asked every year, for 6 years in a row; so people can start and stop medication along the way. However, this is not only reported for antidepressant medication, also for all other kinds of medication. Antidepressive medication has a code which includes 'N06' (no other medication has this code). So people take multiple kinds of medication, and the reasons for dicontinuation are reported for each and every medication.

I need to substract for every year (so, 6 times) the reasons for discontinuation on only antidepressant medication. How can I do this with syntax in order to not do it manually, subject by subject, since there are 700 subjects?

I hope this is somewhat clear, if you need any additional info, please let me know.
Your help is very much appreciated :)


Active Member
You have a set of records that includes a subset labeled 'N06'
The word 'subtract' is used several times in the description, but there is no mention of a numerical value. Do you mean to say you wish to look only at the subset labeled 'N06' that have the "reason for discontinuation" property set to some values?

That's a query or filtering option in most database storage systems, and actions can then be performed on the resulting set. The syntax will depend on the language being used.

I would caution against bulk erasure of records, as it destroys the value of work that went into collecting that information, generally doesn't provide any significant reclaimed storage space, and cuts off future use of historical data for reasons as yet unseen.
Last edited:
Yes, that's what I mean indeed! I need to look at the reasons for dicontinuation for only the 'N06' (= antidepressant) medications, for each subject, on 6 time points.

I thought filtering is definitely the way to go, however, I don't see how I can perform that filter exactly.
Thanks for thinking along! The splitting data is not the issue here unfortunately.

I don't know if it is even possible what I want... The command I want to give SPSS basically is; "only if someone uses AD medication, show me the reasons for discontinuation for that particular medication"

This is the part I am struggling with. Would this be a doable command for SPSS? Or should I do this in certain pieces/steps?
I might need to create a variable that let's me know in which of the ten variables, the AD medication is (that is labeled "N06"), and then combine it with the right variable in which the reasons for discontinuation are recorded.