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...!

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
  • 4 replies
  • 1021 views
  • 0 likes
  • 4 in conversation