BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am new to MACRO

Here's what I wrote to create
d1 as last month this year
d2 as last month last year

data _test_ ;
d1 = put(mdy(month(today())-1,1,year(today())-1),yymmdd10.);
call symput('d1',"'"||put(d1,9.)||" 23:59:59'") ;
d2 = put(mdy(month(today())-1,1,year(today())),yymmdd10.);
call symput('d2',"'"||put(d2,9.)||" 23:59:59'") ;
run ;

%put d1;

I successfully get the value : however when I look into my _test_ table it doesn't give me value that include " 23:59:59"

as well as when I was trying to use %put statment to show me value of d1 ,

What am I missing here ?

Thank you !
4 REPLIES 4
SASPhile
Quartz | Level 8
this will display the resolved value of d1

%put &d1.;
deleted_user
Not applicable
Ah.. Thank you Phile
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Given your SAS DATA step assignment code, suggest the OP look at using the INTNX function to derive (in one statement), a "last month period ending DATETIME" value, using "DTMONTH" as argument #1 and "END" as argument three.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

intnx function month ending date site:sas.com
PatrickG
SAS Employee
Yep, watch out for those missing ampersands...!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1397 views
  • 0 likes
  • 4 in conversation