data calendar_table(drop=sdt edt);
input sdt$ 1-9 edt$ 10-20;
stdate =input(sdt,date9.);
enddate=input(edt,date9.);
format stdate enddate ddmmyy10.;
cards;
12jan2011 13jan2011
13jan2011 14jan2011
14jan2011 15jan2011
15jan2011 16jan2011
16jan2011 17jan2011
17jan2011 18jan2011
run;
proc print;
run;
see actually in the above table i have the dates on which the loading to be happened
In the second table in one cell i will have the Sdate and Edate so i want one table
with one obs of date so that
Ex:
Table 2
Sdate Edate Path Data Fpath
12012011 13012011 c/raw/ order.txt c/raw/12012011/order.txt
I want the dates to go to another table in the Infile path of the job i will
give Fpath in the macro so that it will take data from there daily
if the job again runs the date should increment so i will run for 13 date this is my aim
for the loading data based on date
Sdate Edate Path Data Fpath
13012011 14012011 c/raw/ order.txt c/raw/13012011/order.txt
Small need if indicator and is there it should move the dates having indicaotr=1 and No=2 only how can i do it
data calendar_table(drop=sdt edt);
input sdt$ 1-9 edt$ 10-20 Indicator NO;
stdate =input(sdt,date9.);
enddate=input(edt,date9.);
format stdate enddate ddmmyy10.;
cards;
12jan2011 13jan2011 1 2
13jan2011 14jan2011 1 4
14jan2011 15jan2011 2 3
15jan2011 16jan2011 1 4
16jan2011 17jan2011 1 4
17jan2011 18jan2011 2 5
;
run;
data calendar_table need_table;
set calendar_table;
length path data $ 400;
if indicator=1 and no=4 then do;
path='c:\raw';data='order.txt';
output need_table;delete;end;
output calendar_table;
run;
Req:2 )And i wnat to Edit the need_table and keep the dates if dates 12jan2011 13jan2011 are complted if needed i should call them again as per the logic the calendar_table does not hold these obs if once the date was crossed ,how can i do that.
Reg:3) If need_table; are having dates sdate :15jan2011 and endate:16jan2011 dates in that table i will edit them and again move the date to 13jan2011 and 14jan2011 respectively again it should get the dates accordingly ...
Thqs in advance
Using simple code can get that.
data calendar_table(drop=sdt edt); input sdt$ 1-9 edt$ 10-20; stdate =input(sdt,date9.); enddate=input(edt,date9.); format stdate enddate ddmmyy10.; cards; 12jan2011 13jan2011 13jan2011 14jan2011 14jan2011 15jan2011 15jan2011 16jan2011 16jan2011 17jan2011 17jan2011 18jan2011 ; run; data calendar_table need_table; set calendar_table; length path data $ 400; if _n_ eq 1 then do; path='c:\raw';data='order.txt'; output need_table;delete;end; output calendar_table; run;
Ksharp
Small need if indicator and is there it should move the dates having indicaotr=1 and No=2 only how can i do it
data calendar_table(drop=sdt edt);
input sdt$ 1-9 edt$ 10-20 Indicator NO;
stdate =input(sdt,date9.);
enddate=input(edt,date9.);
format stdate enddate ddmmyy10.;
cards;
12jan2011 13jan2011 1 2
13jan2011 14jan2011 1 4
14jan2011 15jan2011 2 3
15jan2011 16jan2011 1 4
16jan2011 17jan2011 1 4
17jan2011 18jan2011 2 5
;
run;
data calendar_table need_table;
set calendar_table;
length path data $ 400;
if indicator=1 and no=4 then do;
path='c:\raw';data='order.txt';
output need_table;delete;end;
output calendar_table;
run;
Req:2 )And i wnat to Edit the need_table and keep the dates if dates 12jan2011 13jan2011 are complted if needed i should call them again as per the logic the calendar_table does not hold these obs if once the date was crossed ,how can i do that.
Reg:3) If need_table; are having dates sdate :15jan2011 and endate:16jan2011 dates in that table i will edit them and again move the date to 13jan2011 and 14jan2011 respectively again it should get the dates accordingly ...
Thqs in advance
For your situation, I think you can use CALL EXECUTE statement to perform your job.
Firstly make a macro to include what you need to do. then use
if indicaotr=1 and No=2 then call execute('%myjob('||stdate||','||enddate);
Ksharp
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: