BookmarkSubscribeRSS Feed
dmitrym
SAS Employee
Hello everyone,

I have been trying to figure this out for the second day now, and decided to find out if anyone here knows a way.

The task I need to accomplish is the following:

I have a variable k='01JAN2008'd;
In order to call several datasets which have the name in the following form: work....._01JAN2008, work....._07JAN2008, and so on, I was trying to convert k, k+7*d, to character in a single line of code. I was trying to do the following:

%macro a;
%do i=1 %to 3;
%let dt=%put(%sysevalf(&k+7*&i), date9.);
%end;
%mend;
%aa;

, but have not been successfull. I would really appreciate if somebody could point out what am I doing wrong.

Thanks,
Dmitry
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You will need to use the %SYSFUNC and also use PUTN (instead of %PUT) to resolve a "formatted" SAS date string.

Scott Barry
SBBWorks, Inc.
dmitrym
SAS Employee
Thank you very much! Worked like a charm

Dmitry

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
  • 2 replies
  • 671 views
  • 0 likes
  • 2 in conversation