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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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