BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10

You cannot run this code however I have general question

data Month_END_01;
set Month_End_END_1;
as_of_date = put(as_of_date,datetime.);
run;

 

The data is supposed to display a datetime in a field called as_of_date.  Instead it displays a series of characters ***  I tried converting using as_of_date = put(as_of_date,datetime.);  however it simply converts it to a numeric with no data at all.  Is there a solution?  I cannot replicate this so I cannot display a code example

3 REPLIES 3
PaigeMiller
Diamond | Level 26

Are there ERRORs or WARNINGs in the log? If yes, what is the exact word-for-word message?

 

What does PROC CONTENTS say the data type (numeric or character) is variable AS_OF_DATE in data set Month_end_END_1? What does PROC CONTENTS say the format is for variable AS_OF_DATE in data set Month_end_END_1? What is the exact appearance of the values of this variable in data set Month_End_END_1?

 

What happens if you try this?

 

as_of_date1 = put(as_of_date,datetime.);

 

Lastly, @Q1983, I asked you many of these questions in your earlier thread, and no answer was provided. Please provide the answers. We can't help you without answers.

--
Paige Miller
Reeza
Super User

You cannot convert into the same named variable. 

What is the original type and format of the variable as_of_date?

E.g. Character format=$10 or Numeric format=Datetime22.

 

 

Reeza
Super User
Also what's the database and type of the column in the DB?
e.g Oracle, Date

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
  • 3 replies
  • 326 views
  • 2 likes
  • 3 in conversation