data CCA;
b = '2Jan1583'd;
run;
proc print data = CCA;
format b weekdate31.;
run;
tianerhu_0-1629330182074.png
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;
tianerhu_0-1629334228318.png
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;
tianerhu_0-1629334228318.png
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;
tianerhu_0-1629334228318.png
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;
CFC_SAS_Communities_400x225.jpg
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.