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 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 654 views
  • 2 likes
  • 3 in conversation