BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KafeelBasha
Quartz | Level 8

Hello

 

date.pngThe format for the variable "race_date" is MMDDYY10. and there are 10 characters in the variable - 2 for date, 2 for month, 4 for year and two forward slashes.
 
Can you please let me know why the variable is displaying a Length of 8 in Column Properties.
1 ACCEPTED SOLUTION

Accepted Solutions
ShagilImam
Obsidian | Level 7

In SAS, Dates are stored as numeric values. Numeric values (by default) use 8 bytes in storage. 

The date values are not stored as is, but are converted in to a number by calculating the number of days that have passed from 1st Jan 1960, to the given date. This number is then stored in numeric form taking up 8 bytes by default.

 

Formats simply tell SAS how a value should be displayed. You can change the format without affecting whatever value was actually stored. For example, if you changed the format to MMDDYY5., then the dates would only display MM/YY part of the date. But that would not affect the actual value stored, so, if you went back to using the format MMDDYY10., then you would see the date how it is seen now. 

View solution in original post

1 REPLY 1
ShagilImam
Obsidian | Level 7

In SAS, Dates are stored as numeric values. Numeric values (by default) use 8 bytes in storage. 

The date values are not stored as is, but are converted in to a number by calculating the number of days that have passed from 1st Jan 1960, to the given date. This number is then stored in numeric form taking up 8 bytes by default.

 

Formats simply tell SAS how a value should be displayed. You can change the format without affecting whatever value was actually stored. For example, if you changed the format to MMDDYY5., then the dates would only display MM/YY part of the date. But that would not affect the actual value stored, so, if you went back to using the format MMDDYY10., then you would see the date how it is seen now. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 725 views
  • 0 likes
  • 2 in conversation