BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Rixile106
Fluorite | Level 6
DATA want;
SET have ;

	FORMAT Open_Dt DATE9.;
 Open_Dt= PUT (TAKE_UP_DATE_CD,YYMMDD10.) ;
RENAME DIFF =DIFF_AMT ;

RUN 

can you please assist in converting this a numberic value to date format 

expected outcome 

 

 

Rixile106_0-1693311393703.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Numbers like this look like dates to human, but are not dates to SAS. The conversion is

 

newdate=input(put(date,8.),yymmdd8.);
format new_date date9.;
--
Paige Miller

View solution in original post

6 REPLIES 6
Astounding
Opal | Level 21

What is the name of the variable that you wish to convert?

 

Give a few examples of the values that it currently has.

Rixile106
Fluorite | Level 6
it is a numeric value
Astounding
Opal | Level 21

You get no information until you actually answer my questions.

Rixile106
Fluorite | Level 6

Rixile106_0-1693313893486.png

 

PaigeMiller
Diamond | Level 26

Numbers like this look like dates to human, but are not dates to SAS. The conversion is

 

newdate=input(put(date,8.),yymmdd8.);
format new_date date9.;
--
Paige Miller
Astounding
Opal | Level 21

You answered one question, but not the other.  Without knowing the variable name you are talking about, we have to guess which variable you mean.

 

@PaigeMiller took a good guess.  I suggest you try his solution.  But be consistent in your choice of names for the new variable:  new_date vs. newdate.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 275 views
  • 0 likes
  • 3 in conversation