BookmarkSubscribeRSS Feed
Flip
Fluorite | Level 6
Have I lost my mind or is somethin wrong here?

data _null_;
cur_yr = year(today());
cur_day = day(today());
cur_mnth = month(today());
x= catx(put(cur_mnth, z2.), put(cur_day, z2.), put(cur_yr, z4.));
y = compress(put(cur_mnth, z2.)|| put(cur_day, z2.) || put(cur_yr, z4.));
put 'HERE ' cur_mnth cur_day cur_yr ;
put x=;
put y=;
call symput('rundat8', catx(put(cur_mnth, z2.), put(cur_day, z2.), put(cur_yr, z4.)));
run;
%put &rundat8 ;

Results in
HERE 1 28 2011
x=28012011
y=01282011
NOTE: DATA statement used (Total process time):
real time 0.05 seconds
cpu time 0.00 seconds


33 %put &rundat8 ;
28012011

How is the CATX reversing the order of the values?
Same result in 9.1 on Unix and 9.2 on WIN 7
2 REPLIES 2
RickM
Fluorite | Level 6
Check the catx syntax

CATX(separator, string-1 <, ...string-n>)

01 is being used as the separator for the other two strings.
Flip
Fluorite | Level 6
Thanks, I knew it had to be a Friday afternoon brain death.

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


Register now!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1065 views
  • 0 likes
  • 2 in conversation