1
votes

I have a data set where I am trying to duplicate each observation with a different month (1-12). In essence for one observation, I want 12 new observations where all of regular data is the same except the month value changes. These will be passed off into a proc SCORE equation for a regression project.

I am using SAS and SQL without success- I do not have anything to complete the outer join on between months and original.

If any insight could be given for something that doesn't seem too hard, I would really appreciate it. Thanks!

data months;
do i=1 to 12;
    monthval=i;
output;
end;
run;

proc sql;

create table temp as
SELECT *
from original
FULL JOIN Months
;
quit;
1

1 Answers

1
votes

Your first data step is fine, just add the original to it.

Data months;
set original;
do monthval=1 to 12;
  output;
end;
run;

Your SQL is fine, also, just use a natural (comma) join.

proc sql;  
create table temp as
SELECT *
from original, Months
;
quit;