BookmarkSubscribeRSS Feed
AliMN
Calcite | Level 5

Can you please help to change SAS EG dates? it's SAS EG version: 5.1

this is the current format I dont want

Type: Character        Length:500

Group: Character

Format: $500.

Informat:$500.

2014-01-01 00:00:00

2014-01-01 00:00:00

2014-01-01 00:00:00

I want this below format

Type: Numeric       Length: 8

Group: Date

Format:DATETIME20.

Informat:DATETIME20.

01JAN2014:00:00:00

01JAN2014:00:00:00

01JAN2014:00:00:00

Your help is greatly appreciated.

5 REPLIES 5
DBailey
Lapis Lazuli | Level 10

Are you importing a file using the EG wizard?  If so, you can change the type and format of the data in the wizard.  If not, then what are you doing that is creating these text formats?

AliMN
Calcite | Level 5

I tried to change it in the wizard but after I changed the whole column become blank.

Reeza
Super User

Use the conversion function

input(date_var, anydtdtm.)

You can use this in a query with a calculate column or in a data step.

AliMN
Calcite | Level 5

Reeza - Do you mean like the following?
newdatecolumn = input(date_var, anydtdtm.)

Can you explain more?

Reeza
Super User

In a query, create a calculated field, custom calculation, using the above formula.

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
  • 5 replies
  • 855 views
  • 0 likes
  • 3 in conversation