Fist of all sorry, seems I've done multiposting, but that wasn't done on purpose, just maybe in case of a long moderation time.. (another post: https://communities.sas.com/t5/SAS-Programming/combining-multiple-tables-qty-various-in-one-dataset-table-by/m-p/562778#M157698 ) @Tom @Panagiotis About the subject: as I see it - I have dates table which in example has 2 rows, but in life can have 10-50 rows or more. For each datevalue I thought to make a single output table. After, I thought to make one huge table being base on the output ones. Finally, after thinking, I've reached a result which I expected(solvation for me was in proc append), but maybe it is not the most optimal way - I am rather new both in SAS and SQL, so I can't judge about it.. Code: (output_date = want) data input_dates;
length dt $9;
input dt;
dtnum +1;
datalines;
01JAN1950
01JUL1950
;
run;
data output_dates;
input DATE;
format DATE date9.;
input AIR;
format AIR int;
datalines;
;
proc sql noprint; select count(*) into: dtcnt from input_dates; quit;
%macro aaa;
%do i=1 %to &dtcnt;
proc sql noprint; select dt into: rdate from input_dates where dtnum = &i; quit;
proc sql;
create table a1 as
select date, air
from sashelp.airline
where date < "&rdate."d
order by date desc;
create table a11 as
select date, air
from a1(firstobs=1 obs=1);
quit;
proc append base = output_dates data = a11;
run;
%end
%mend aaa
%aaa
... View more