BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ronein
Meteorite | Level 14

Hello

 

%let TodayP='20Aug2018'd;

What is the way that  TodayP parameter will get date value of today automatically?

 

 

thanks

Joe

1 ACCEPTED SOLUTION

Accepted Solutions
Criptic
Lapis Lazuli | Level 10
%let today = %sysfunc(today(), yymmddn8.);
%put &today;

View solution in original post

3 REPLIES 3
Criptic
Lapis Lazuli | Level 10
%let today = %sysfunc(today(), yymmddn8.);
%put &today;
Kurt_Bremser
Super User

And if you just need that for use in code:

if mydate le &todayp. then .....

then omit any formatting altogether:

%let TodayP=%sysfunc(today());

Date and time values only need formats when used for display. See Maxim 28.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Why would you need to create your own parameter?  SAS already provides numerous methods to get today's date and time in whatever format you need.  Do not create macro variables and code just for the sake of it!!

sas-innovate-2024.png

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.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 900 views
  • 3 likes
  • 4 in conversation