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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.