So this is a separate question following from my last post. It is in regards to the same variable "question_order", but now I am trying to convert the string's contents into a time index. So again my code is below:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float ID byte _j strL question_order
1 1 "CountrysideDrawing2|GraffitiDrawing1|GraffitiDrawing2|StillLifeDrawing1|HouseDrawing2|HouseDrawing1|StillLifeDrawing2|CountrysideDrawing1"
1 2 "CountrysideDrawing2|GraffitiDrawing1|GraffitiDrawing2|StillLifeDrawing1|HouseDrawing2|HouseDrawing1|StillLifeDrawing2|CountrysideDrawing1"
1 3 "CountrysideDrawing2|GraffitiDrawing1|GraffitiDrawing2|StillLifeDrawing1|HouseDrawing2|HouseDrawing1|StillLifeDrawing2|CountrysideDrawing1"
1 4 "CountrysideDrawing2|GraffitiDrawing1|GraffitiDrawing2|StillLifeDrawing1|HouseDrawing2|HouseDrawing1|StillLifeDrawing2|CountrysideDrawing1"
1 5 "CountrysideDrawing2|GraffitiDrawing1|GraffitiDrawing2|StillLifeDrawing1|HouseDrawing2|HouseDrawing1|StillLifeDrawing2|CountrysideDrawing1"
1 6 "CountrysideDrawing2|GraffitiDrawing1|GraffitiDrawing2|StillLifeDrawing1|HouseDrawing2|HouseDrawing1|StillLifeDrawing2|CountrysideDrawing1"
1 7 "CountrysideDrawing2|GraffitiDrawing1|GraffitiDrawing2|StillLifeDrawing1|HouseDrawing2|HouseDrawing1|StillLifeDrawing2|CountrysideDrawing1"
1 8 "CountrysideDrawing2|GraffitiDrawing1|GraffitiDrawing2|StillLifeDrawing1|HouseDrawing2|HouseDrawing1|StillLifeDrawing2|CountrysideDrawing1"
2 1 "StillLifeDrawing2|GraffitiDrawing1|HouseDrawing2|HouseDrawing1|GraffitiDrawing2|StillLifeDrawing1|CountrysideDrawing2|CountrysideDrawing1"
2 2 "StillLifeDrawing2|GraffitiDrawing1|HouseDrawing2|HouseDrawing1|GraffitiDrawing2|StillLifeDrawing1|CountrysideDrawing2|CountrysideDrawing1"
2 3 "StillLifeDrawing2|GraffitiDrawing1|HouseDrawing2|HouseDrawing1|GraffitiDrawing2|StillLifeDrawing1|CountrysideDrawing2|CountrysideDrawing1"
2 4 "StillLifeDrawing2|GraffitiDrawing1|HouseDrawing2|HouseDrawing1|GraffitiDrawing2|StillLifeDrawing1|CountrysideDrawing2|CountrysideDrawing1"
2 5 "StillLifeDrawing2|GraffitiDrawing1|HouseDrawing2|HouseDrawing1|GraffitiDrawing2|StillLifeDrawing1|CountrysideDrawing2|CountrysideDrawing1"
2 6 "StillLifeDrawing2|GraffitiDrawing1|HouseDrawing2|HouseDrawing1|GraffitiDrawing2|StillLifeDrawing1|CountrysideDrawing2|CountrysideDrawing1"
2 7 "StillLifeDrawing2|GraffitiDrawing1|HouseDrawing2|HouseDrawing1|GraffitiDrawing2|StillLifeDrawing1|CountrysideDrawing2|CountrysideDrawing1"
2 8 "StillLifeDrawing2|GraffitiDrawing1|HouseDrawing2|HouseDrawing1|GraffitiDrawing2|StillLifeDrawing1|CountrysideDrawing2|CountrysideDrawing1"
end
ID refers to the participant, _j refers to the number of responses for each participant, and question_order refers to the order in which the _j responses were given over time. If _j = 1 then it references "GraffitiDrawing1", _j = 2 "GraffitiDrawing2", _j = 3 "HouseDrawing1", _j = 4 "HouseDrawing2", _j = 5 "CountrysideDrawing1", _j = 6 "CountrysideDrawing2", _j = 7 "StillLifeDrawing1", and _j = 8 "StillLifeDrawing2".

The question_order string structurally implies time_periods (very short time periods) that are separated with the pipe character "|". For example, the first question/response participant 1 received was "CountrysideDrawing2" or _j = 6; the second, "GraffitiDrawing1"; and so on... As you can see my data is also in 'long-format' hence where the _j variable comes from.

I am trying to find a clean way to produce a variable "t" for the time period that will capture the order in which they received the stimuli. I cannot think of a clean way of doing this, but I am also still learning STATA.

Any help would be great. Thanks in advance!