From what you've shown here, arrays won't help.
I see that some companies have only one year data while other may have more.
I understand that for each company-year you want the all 4 periods.
I suggest you try next code:
proc sql;
create table companies as
select distint company, yymm_e
from have;
quit;
data skeleton;
set companies;
year = year(yymm_e) -1; /* assuming yymm_e is a sas date variable */
/* if it is a six digits number then year = int(yymm_e / 100) -1; */
array qtr 03 06 09 12;
do i=1 to 4;
yymm = mdy(qtr,1,year);
output;
end;
format yymm yymmn6. ;
keep company yymm;
run;
data want;
merge skeleton have;
by company yymm;
run;
Look at each of the tables that were created at the process.
If the want table is not the desired result - please post the result of one company and show what's wrong with it and what should be.
I believe this question has been answered here:
https://communities.sas.com/t5/Base-SAS-Programming/How-can-I-create-a-table/m-p/383905#M91605
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.