Background: I am working with a qualitative data coding scheme that contains seven ordered levels of codes. Five of these contain a single option and two contain two mutually exclusive options. A given code can be a concatenation of up to seven component codes, but they must occur in the order of the levels (thus we have permutations rather than combinations). The hard part is that a code may contain any number of levels, 1-7.
Level 1 : A
Level 2 : B or C
Level 3 : D or E
Level 4 : F
Level 5 : G
Level 6 : H
Level 7 : I
Equally valid example codes : ABDFGHI, ACF, I, FGHI, ACE, FH
Issue: I need to create a list of all valid codes, but am struggling with strategy since the permutations can be of any length and I cannot find relevant existing questions posed here. My initial intent was to use R but any way I could get a complete list is welcome. Any pointers out there?