BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,
I tried the code below where the informat statement was used:
*------------;
data name;
informat FirstName $8. LastName $15. date mmddyy8. n2 7.3;
input firstname $ lastname $ date n2;
datalines;
a b 010101 100
;
*------------;
All the variables are displayed correctly except date. It displayed as a strange numeric value 14976 instead of a date format. Can anyone give some hints on where is wrong?
Thanks!
gim
1 REPLY 1
garybald
Calcite | Level 5
SAS stores a date internally as the number of days since January 1, 1960. If you don't give the variable a format when you print it, you will get the internally stored value. Try printing with the mmddyy10. format.

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
  • 618 views
  • 0 likes
  • 2 in conversation