Dear Statalist users,
I would like to ask a question regarding looping over a pair of local macros. I have a dataset with dates and firm returns where Date1 belongs to the returns of firm1, Date2 to firm2, and so on. Now I would like to separate this big dataset into smaller chunks and only keep the combination of Date1 & firm1, Date2 & firm2 etc. How do I specify a loop that does exactly that? Thank you.
I would like to ask a question regarding looping over a pair of local macros. I have a dataset with dates and firm returns where Date1 belongs to the returns of firm1, Date2 to firm2, and so on. Now I would like to separate this big dataset into smaller chunks and only keep the combination of Date1 & firm1, Date2 & firm2 etc. How do I specify a loop that does exactly that? Thank you.
HTML Code:
local date Date1 Date2 Date3 Date4 Date5
local firm firm1 firm2 firm3 firm4 firm5
foreach d of local date {
foreach f of local firm {
peserve
keep `d' `f'
save data_`d'_`f', replace
restore
}
}

Comment