BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Reeza
Super User

So it seems like you're trying to make a  macro variable match what your code would look like if you were typing it out manually. However, you don't actually need to do that. SAS stores datestimes as numbers, counting the number of seconds from January 1, 1960. 

 

If you convert it to an actual SAS datetime variable you can then use that in your code correctly. Ideally you should use the exact datetime format you're using but you can also do this. FYI - depending on how you created this macro variable in the first place it my be a good idea to change how it's stored from the start to avoid this issue entirely. 

 

%let date_start = %sysfunc(inputn(29Jan16:11:07:33, anydtdtm.));
....



where t1.datetime <= &date_start;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 15 replies
  • 1498 views
  • 6 likes
  • 8 in conversation