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 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!

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