01-11-2017 12:56 AM
I have my program as
%let dattt= %sysfunc(catx(T,&date,&time));
the value for &dattt is 26Jan2017T12,
But i want my value as 26Jan2017T0012,
Why im not getting 0012 for my time.
Please could any one help.
01-11-2017 01:47 AM
It thinks it's a number. Because the function takes char and num types either are valid and it has to guess at types in macro format. I don't know what the rules are, if you're really interested I would contact tech support.
You may be able to force it in the SYSFUNC by including quotes around the value.
01-11-2017 02:19 AM
I have given with the quotes as %let datt=%sysfunc(catx(T,"&date","&time"));
I am getting the value but along with the quotes.
I would be very Thankfull if you could consult tech support and help me to know this.
01-11-2017 09:23 AM
Agree with @Reeza. I don't see a way to tell CATX that the value that looks like a number is not a number. And generally for concatenation in the macro language CAT functions are not needed, as shown in the accepted solution.
That said, if you went the route of adding quote marks, in the macro language those quote marks are part of the value (not a way to indicate that a value is text). The good news is that when a quote mark (or any other non-numeric character) is part of the value, CATX will see that it is not a number. But because those quote marks become part of the value, you would have to removed them yourself.
So in theory, you could hack it as something like:
40 %let date=26Jan2017; 41 %let time=0012; 42 %let datt=%sysfunc(compress(%sysfunc(catx(T,"&date","&time")),%str(%"))); 43 %put &datt; 26Jan2017T0012
Need further help from the community? Please ask a new question.