Hi all,
I have a table that contains customer_id (around 1 Millions) and would like to create some random dates for these customers between 01/01/2015 and 01/01/2017 .
Please your help would be much appreciated as it is quite urgent.
Thank You very much
%let start=01/01/2015;
%let end=01/01/2017;
data _null_;
start = input("&start",ddmmyy10.);
end = input("&end",ddmmyy10.);
interval = end - start;
call symput('start',put(start,best.));
call symput('interval',put(interval,best.));
run;
data want;
set have;
format newdate ddmmyy10.;
newdate = &start + rand() * &interval;
run;
Post test data in the for of a datastep!! Also post what you want out.
Here is an example, the diff between the two dates * by random number added to the base date, gives a date between the two values:
data tmp;
call streaminit(123);
a="01JAN2015"d;
b="01JAN2017"d;
test="01JAN2015"d + floor((b-a) * rand("uniform"));
format a b test date9.;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.