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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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