Help using Base SAS procedures

Reg:Moving of Date

Reply
Contributor
Posts: 66

Reg:Moving of Date

Moving Data HI actually i am having dates in one table cal
actually i am having stdate and enddate


data l(drop=sdt edt);
input sdt$ 1-9 edt$ 10-20;
stdate =input(sdt,date9.);
enddate=input(edt,date9.);
format s1 E1 ddmmyy10.;
cards;
12jan2011 13jan2011
13jan2011 14jan2011
14jan2011 15jan2011
15jan2011 16jan2011
16jan2011 17jan2011
17jan2011 18jan2011
run;

Actually i want the dates to got to one table with single observation as i run that it should move to another date like that

For Example the out put should be in another table with one obs so that i will resolve that
date in a macro and will make the infile

the date will be c:\raw\12012011\

so if i run that it will resolve to date 12012011 i will concatenae c:\raw\ to that

if i  again run the job it shoul go to 13012011 it will be c:\raw\13012011\


so if one single obs going to another table i will resove the date from that table

Contributor
Posts: 66

Re: Reg:Moving of Date

Actually in the above table i will be having all the dates


now i want another table having one obs i that i will give the raw file path and concatenate it with the dates
and if again i rerun the job it should move to the next date and it will concatenate with the path..

Output in another table with single obs

Raw path  dt

c:\raw  12012011

If i again rerun it the output with single obs table should be

Raw path  dt

c:\raw  13012011

PROC Star
Posts: 7,363

Re: Reg:Moving of Date

I don't understand what you are asking.  The code in your initial post in confusing as well.  Why don't you just read the dates in, directly, using the date9. informat?  And why do you format variables that you don't have?

More so, it would help for you to explain what your input file actually looks like, what file(s) you want as output, and what should be used as the decision rule(s).

Contributor
Posts: 66

Re: Reg:Moving of Date

data l(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 i 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

If it is messy refer the text file

Attachment
Ask a Question
Discussion stats
  • 3 replies
  • 163 views
  • 0 likes
  • 2 in conversation