Hello
What is the purpose of -l in the following code?
What is the difference between DOWNAME9. and weekdate9. formats?
data ex2;
ddate_time=datetime();/*today's datetime value for example*/
ddate=datepart(ddate_time);
day_of_week=put(ddate,DOWNAME9.);
day_of_week2=put(ddate,weekdate9. -l);
format ddate_time datetime20. ddate date9. ;
run;
As per the official documentation on PUT function (as here), I am guessing -L is for left align, -C for centre align and -R for right align. Since you are extracting a weekdate (which is a character), it is right aligned by default. I guess you are overriding that behaviour with -L option.
You can do a quick test by substituting -l with -c and -r to see if the alignment changes. If it does then probably that is it. Please let me know the outcome of substituting -l with -c and -r.
Thank you
@Ronein Actually I went ahead and played with -L and -R options myself and the results are as per the documentation. Please see the image below. -L aligns to left and -R to the right.
Maxim 1: Read the Documentation. Because it's all there:
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.