Hi,
I am doing some research on Crash data and I want to investigate few crashes happened on particular dates.
My data is in MDY format and these are the dates i want to investigate (11/5/2017),(12/31/2017) &(01/04/2018)
I know the function to select dates between two periods, not sure of selecting particular dates.
Your advice is much appreciated.
data want;
set have;
where date in ('05nov2017'd, '31dec2017'd, '04jan2018'd);
run;
data output;
set input;
where crash_date in ('05Nov2017'd, '31Dec2017'd, '04Jan2018'd);
run;data output;
set input;
where input(crash_date,mmddyy10.) in ('05Nov2017'd, '31Dec2017'd, '04Jan2018'd);
run;Depends on the actual format of the dates stored in your table.
If the dates are in text format this might work:
data...
set ...
if date in ('11/5/2017' '12/31/2017' '01/04/2018');
run;
If the dates are in numeric format then this might work:
data...
set ...
if date in ('05NOV2017'd '31DEC2017'd '04JAN2018'd);
run;
//Fredrik
data want;
set have;
where date in ('05nov2017'd, '31dec2017'd, '04jan2018'd);
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.