So I have several lists that are the headers of variables in a data file. The setup looks like this:
headerGroup1 = ["1", "2", "3, "4", "5"] headerGroup2 = ["6", "7", "8, "9", "10"] headerGroup3 = ["1", "2", "3", "4", "5"]
And I have a master file that looks like this:
masterVars = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
I want to do three things:
- Create a list that includes all the items from masterVars in order. And I don’t know if values are unique.
- If a list item contained in headerGroupX is in the masterVars, prepend that header group to the list item.
- Dump a list that contains all 64k items into something I can manage in SPSS (sort of kidding about this one)
I think this would be simple if there were only 2 lists. The big problem I think I’m running into is what happens after you prepend data to a list item. But I’m not totally sure what I’m messing up.
EDITED:
Here is an example of what I would want to output:
newMasterFile = ["headerGroup1, headerGroup3, 1", "headerGroup1, headerGroup3, 2", etc.]
Does this make anything clearer?
Or do you like more readable version? 😉
PS. What is SPSS?