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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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