BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Thalitacosta
Obsidian | Level 7
I have two date variables that I need to format: - the variable "dt" has the "DDMMYY10." format; and - the variable "dt_current" has the "E8601DT26.6" format. When I do the code below, the variable "dt_current" returns missing. What format should I use? proc sql; create table NV2 as select DT format=monyy5., DT_CURRENT format=monyy5. from NV1; quit;
1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ

Hello,

 

as "E8601DT26.6" is a date-time format (date + time) you need to extract the datepart from DT_CURRENT in order to be able to successfully use the monyy5. format :

 

datepart(DT_CURRENT) format=monyy5.

 

Koen

View solution in original post

2 REPLIES 2
sbxkoenk
SAS Super FREQ

Hello,

 

as "E8601DT26.6" is a date-time format (date + time) you need to extract the datepart from DT_CURRENT in order to be able to successfully use the monyy5. format :

 

datepart(DT_CURRENT) format=monyy5.

 

Koen

Tom
Super User Tom
Super User

Looks like you have only one DATE variable. The other one is a DATETIME variable.  Date values are stored as number of days. Datetime values are stored as number of seconds.  So you cannot use the same format to display both of them.  But you could use the DTMONYY5. format to display the datetime value in the same MONYY style.

 

PS Why are you displaying only two of the four digits of the year?  That can cause confusion about which century the values represent.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 318 views
  • 1 like
  • 3 in conversation