BookmarkSubscribeRSS Feed
Jbraun
Fluorite | Level 6

Dear SAS users

 

I have a variable "Birth_date" with dates of birth. The variable containts numbers between 14316 and 36329. As far as I know the SAS date of birth format counts from the year 1960 so that jan 1st 1960 is "1" and so forth.

 

If I do a proc freq with a date9. format I get dates between year 2011 and year 2052. That doesn't quite make sense since the data should be covering current employees from ages at maybe 16 and up. So I would expect dates between maybe year 1940 and year 2000 or something like that:

 

proc freq data =NEW.Samlet;

format Birth_date date9.;

table Birth_date;

run;

 

Am I doing something wrong or does my data simply contain nonsense?

 

Kind regards,

Jacob

6 REPLIES 6
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Where do you get those numbers from?  14316=13MAR1999?

Did you get the data from Excel, if so Excel holds date values from a different base date so the number is different.

Jbraun
Fluorite | Level 6

Dear RW9

 

The data comes from an employee database and we use SAS primarily so therefore I was expecting the numbers to express a SAS-format. I thought that maybe the explanation was that more than one baseline-format existed in SAS, such as if a 1900-baseline was also sometimes used, then maybe that would explain the distribution.

 

Kind regards,

Jacob

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well there is:

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000197881.htm

 

However you need to know what those numbers actually refer to.  I would also be careful about changing the option as it may affect other data's representation in the same session.

Jbraun
Fluorite | Level 6

Thanks

ballardw
Super User

@Jbraun wrote:

Dear SAS users

 

I have a variable "Birth_date" with dates of birth. The variable containts numbers between 14316 and 36329. As far as I know the SAS date of birth format counts from the year 1960 so that jan 1st 1960 is "1" and so forth.

 


You might be interested to know that those example numbers will be 3/12/1939 and 6/18/1999 if treated as EXCEL date values which uses 1/1/1900 as it's base date. Perhaps the data base imported data from Excel but did not use or associate a date format with them, or the date format did not carry over from export or however you moved the data into SAS.

 

 

Jbraun
Fluorite | Level 6

@ballardwthanks, that age span would definitely make a lot more sense. I will of course look for documentation to make sure.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1617 views
  • 1 like
  • 3 in conversation