Hi,
strange thing happens when I try the following:
%let DATE = %sysfunc(intnx(day,%sysfunc(TODAY()),-1),yymmddd10.); run;
it works fine and shows as result: 2017-03-18 (as today is the 19th, and yesterday was the 18th, so it's okay).
But, when you try:
%let test = %sysfunc(cat(Keep Attention ,&datum)); %put &test;
you will see that the result is not Keep Attention 2017-03-18, but it's like Keep Attention1988 which seems very strange to me.
Anyone any idea how I can concate the string "2017-03-18" or any similar to an string? The other date formats work fine, but that's not the point.
Regards, Vic
okay, wow, it works. I will try to embed it into a macro, but I don't see that it won't be the right solution. I very think your're right.
It will be something like this at the end:
%let TEST = MIS 1234 - P9 EXECUTIVE REPORT Export &&DATE&;
within a macro but I will try tomorrow (as it is late now here in Germany :)).
Regards, Vic
It doesn't seem too strange that the combination of %SYSFUNC and CAT might strip the elements being concatenated. 1988 is indeed strange. I could imagine getting 1996 if that combination of %SYSUNC and CAT were to actually perform the subtraction (2017 minus 3 minus 18). At any rate, macro language is built to concatenate character strings without functions. Try:
%let test = Keep Attention &datum;
That should handle the problem nicely.
Hi,
thank you very much for answering. My point is/was that I use it within a macro as it reads multiple Excelfiles. But maybe my way is not very productive, so I will try your proposal.
I will report if it works :).
Regards, Vic
okay, wow, it works. I will try to embed it into a macro, but I don't see that it won't be the right solution. I very think your're right.
It will be something like this at the end:
%let TEST = MIS 1234 - P9 EXECUTIVE REPORT Export &&DATE&;
within a macro but I will try tomorrow (as it is late now here in Germany :)).
Regards, Vic
I get 1996
%let DATE = %sysfunc(intnx(day,%sysfunc(TODAY()),-1),yymmddd10.); run;
%let test = %sysfunc(cat(Keep Attention ,&date)); %put &test;
2817 %let DATE = %sysfunc(intnx(day,%sysfunc(TODAY()),-1),yymmddd10.); run;
2818 %let test = %sysfunc(cat(Keep Attention ,&date)); %put &test;
SYMBOLGEN: Macro variable DATE resolves to 2017-03-18
SYMBOLGEN: Macro variable TEST resolves to Keep Attention1996
Keep Attention1996
2017 - 03 - 18 = 1996
2017 - 3 = 2015
2015 - 18 = 1996
some solutions;
%symdel test date /nowarn;
%let DATE = %sysfunc(intnx(day,%sysfunc(TODAY()),-1),yymmddd10.); run;
%let test = %sysfunc(cat(Keep Attention)) &date; %put &test;
Keep Attention 2017-03-18
%symdel test date tst /nowarn;
%let DATE = %sysfunc(intnx(day,%sysfunc(TODAY()),-1),yymmddd10.); run;
%let test = %sysfunc(cat(Keep Attention,'&date')); %put &test;
%let tst=%sysfunc(compress(&test,%str('')));%put &tst;
Keep Attention 2017-03-18
or
data _null_;
date=put(intnx('day',%sysfunc(TODAY()),-1),yymmddd10.);
test = cat('Keep Attention' ,date);
put test;
run;quit;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.