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.
L and R option difference
Maxim 1: Read the Documentation. Because it's all there:
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.