Hello everyone.

I have 96 variables called moisx, where x takes values between 1 & 96. Each of these variables refers to a month in the life of each individual. All variables moisx are string variables, with a letter on the fifth position indicating if the individual was living alone, or as a couple during this particular month. .

The variable nseq1 takes values from 1 to 96 and refers to the month number of the month during which the individual had his/her first child.
The variable if_07 takes values from 94 to 96, and refers to the last month for which we have data in the survey.

I want to create variable memeconj that equals 1 if between the month referred to by nseq1 (when the child was born) and the month referred to by if_07, the individual has been living as a couple without interruption. In other words, I want
Code:
memeconj==1 if substr(hmoisx, 1, 5)=="c"
for all variables moisx where nseq1=<x=<if_07

How can i code memeconj properly ?

Thanks a lot ! !

Mateo Acosta