data CCA;
b = '2Jan1583'd;
run;
proc print data = CCA;
format b weekdate31.;
run;
why it is 'NOV' ?
@tianerhu wrote:
I am sorry . the year is not 1583 , is 1582 , the following is the revised code :
data CCA; b = '1Jan1582'd; run; proc print data = CCA; format b weekdate31.; run;
From the documentation on dates:
data CCA; do b = '1Jan1582'd to '15Nov1582'd ; output; end; run; proc print data = CCA; format b weekdate31.; run;
It's not?
I ran your code and this is what I get in SAS ODA.
Obs | b |
---|---|
1 | Sunday, January 2, 1583 |
@tarheel13 wrote:
It's not?
I ran your code and this is what I get in SAS ODA.
Obs b 1 Sunday, January 2, 1583
Same with SAS 9.4.4
I am sorry . the year is not 1583 , is 1582 , the following is the revised code :
data CCA;
b = '1Jan1582'd;
run;
proc print data = CCA;
format b weekdate31.;
run;
Okay. I see the same as you. But why are you using a date from the 1500s?
Okay. If you use different years like 1982 or 2003, it won't show 'NOV' at the beginning.
Well, the good news is I feel like it is pretty unlikely that you would ever work with date values from the 1500s loll.
@tianerhu wrote:
I am sorry . the year is not 1583 , is 1582 , the following is the revised code :
data CCA; b = '1Jan1582'd; run; proc print data = CCA; format b weekdate31.; run;
From the documentation on dates:
data CCA; do b = '1Jan1582'd to '15Nov1582'd ; output; end; run; proc print data = CCA; format b weekdate31.; run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.