Hi Experts,
I have two tables, table aa have the acount number and acount open date, table bb have acount number and
launch_date. I am here trying to create a data set with acount numbers who have opened thiere accounts
7 days after the launch_date. Am using weekday with intck fumction but not getting the desired output. please suggest.
data aa;
input act open_date;
informat open_date date9.;
format open_date date9.;
datalines;
0101 17Apr1990
0202 18May1990
0303 19Jun1991
0404 20Jul1992
;
run;
data bb;
input act launch_Date;
informat Launch_date date9.;
format Launch_date date9.;
datalines;
0101 20Apr1990
0202 21May1990
0303 19Jan2002
0404 20Jan2003
0505 21Jan2004
;
run;
Thanks & RegardS,
Sanjay
I assume you mean WITHIN 7 days of opening the account as none of your sample data fits EXACTLY 7 days after opening. Of course "under the hood" dates are just numbers so a simple merge does the trick unless there's another requirement...
data want;
merge aa bb;
by act;
if launch_date < open_date+8 then output;
run;
I assume you mean WITHIN 7 days of opening the account as none of your sample data fits EXACTLY 7 days after opening. Of course "under the hood" dates are just numbers so a simple merge does the trick unless there's another requirement...
data want;
merge aa bb;
by act;
if launch_date < open_date+8 then output;
run;
"Not getting the desired output" - this does not tell us anything about the issue? From your problem:
proc sql; create table WANT as select A.ACT, A.OPEN_DATE, B.LAUCH_DATE from TABLEA A left join TABLEB B on A.ACT=B.ACT where A.OPEN_DATE=B.LAUNCH_DATE+7; quit;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.