Skyler
Skyler

Reputation: 170

Difference in call symputs for data _null_

After inheriting some code from someone I noticed the following line,

data _null_;
    call symput("date",strip(put(compress(put(date(),YYMMDD10.),'-'),8.)));
run;

Why would I want to have the compress and strip? I find I get the same result by using

data _null_; 
    call symput('date2',put(date(),yymmddn8.)); 
run;

%put &date. &date2.;

The put statement yields the same result for both. Is there a specific reason why I would use a strip and compress for this operation?

Upvotes: 2

Views: 215

Answers (1)

Joe
Joe

Reputation: 63434

That specific one there's no real reason; the put...yymmddn8. doesn't give you any spaces. I imagine that's a standard usage that someone just copy/pasted in - if you don't do the put it will give you spaces/etc.

CALL SYMPUTX is the real solution, anyway; it takes care of that for you :)

Upvotes: 5

Related Questions