DATA Step, Macro, Functions and more

date

Reply
Super Contributor
Posts: 673

date

I have a date 20100430.How to show it as Apr-10?
SAS Super FREQ
Posts: 8,868

Re: date

Hi:
It depends is that value a character string or a number????

cynthia
Super Contributor
Posts: 673

Re: date

Posted in reply to Cynthia_sas
character
Regular Contributor
Posts: 241

Re: date

[pre]
proc format;
picture monyyd
low-high = '%b-%0y' (datatype=date);
run;
data _null_;
d = input('20100430', yymmdd8.);
f = propcase(put(d, monyyd6.));
put f=;
run;
/* on log
f=Apr-10
*/
[/pre]
Super Contributor
Posts: 394

Re: date

[pre]
data _null_;
d = input('20100430', yymmdd8.);
put 'd=' d monname3. '-' d year2.;
run;
[/pre]
writes to the log:
[pre]d=Apr-10
[/pre]
SAS Employee
Posts: 58

Re: date

There's a lot of good info on using SAS dates here. Hopefully, this helps.

http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a002200738.htm
Ask a Question
Discussion stats
  • 5 replies
  • 142 views
  • 0 likes
  • 5 in conversation