BookmarkSubscribeRSS Feed
kajal_30
Quartz | Level 8

Hi ,

 

I need help creating one dataset which should contain two variables 

B_date = today's date and start time 12:00:00 am 

E_date = today's date and end time 11:59:59 pm 

 

Thanks in advance.

2 REPLIES 2
sgottipati
Calcite | Level 5

Please below code.

 

 data temp1;
    b_date=dhms(today(),0,0,0);
    e_date=dhms(today(),23,59,59);
    format b_date e_date datetime.;
    put b_date e_date;
    run;

ed_sas_member
Meteorite | Level 14

Hi @kajal_30 

 

I you only need macrovariables, you can define a %let statement:

%let b_date=%sysfunc(dhms(%sysfunc(today()),0,0,0));
%let e_date=%sysfunc(dhms(%sysfunc(today()),23,59,59));
Best,

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 773 views
  • 5 likes
  • 3 in conversation