Hi all, I have a data set with 280 variables. All but ~35 of them are repeats of question of variables ordered by event. The event is numbered (event1, event2, event3 etc.) but the questions are not (for example event1QX, event1QY, ....event2QX,event2QY, etc.). I'd like to create a loop to reorder the variables first in order of the event (so all questions for event1 are first) and then in a specific order for the questions since the questions aren't actually numbered. So there will be two levels of ordering. I've tried creating a looping for this but the foreach command is looping over the sequence order so that I get event1QX event2QX.......event1QY event2QY and vice versa.
ds event1QX-event25QZ
local event "`rvarlist'"
order `event', seq
foreach var of local event {
order event*QX event*QY event*QZ event*QA event*QB
}
ds event1QX-event25QZ
local event "`rvarlist'"
order `event', seq
foreach var of local event {
order event*QX event*QY event*QZ event*QA event*QB
}
Comment