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

Hi All,

 

I am stuck in a situation. I have data(Date) type is number and format is DATE9

example-

Employee Hire Date

12MAR1985

 

12MAR1985 is number in Date9 format.

I want it to convert into String or Character. So that I can use it in my way.

Please help me on this one.

 

Thanks!

Anmol

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
HireDate_CHAR = put(hiredate, yymmdd8.);

The format in purple is what controls the appearance. You can change the format to get different outputs if desired.

 

View solution in original post

3 REPLIES 3
ballardw
Super User
data want; set have; chardate = put(date, date9.); /* or other date format you did not specify*/ run; Though if "use it my way" involves any further processing in SAS you are likely going to cause yourself more work.
anmolk171
Calcite | Level 5

Hi,

 

can you provide me the exact code. I am new to SAS. My table name is EmpData, variable is HireDate(Number->DateFormat9).

I want to change HireData into character or string.

 

Thanks.

Reeza
Super User
HireDate_CHAR = put(hiredate, yymmdd8.);

The format in purple is what controls the appearance. You can change the format to get different outputs if desired.

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Discussion stats
  • 3 replies
  • 1684 views
  • 0 likes
  • 3 in conversation