DATA Step, Macro, Functions and more

Cannot load date formats

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Cannot load date formats

[ Edited ]

I am trying to convert date values that are currently stored in character format to numeric with a date format, but no matter how I try to code it I get an error saying: ERROR 48-59: The format XXXXX was not found or could not be loaded.

 

I have tried using it in a data step with a format statement:

data new; set old;

format datevar mmddyy10.;

run;

 

I have tried using an input statement to convert it to numeric first.

data new; set old;

date2=input(datevar, mmddyy10.);

run;

 

I have also tried multiple different date formats (date9, mmddyy10, and datetime20). No matter what I do or what date variable I use, I get the message. I'm not trying to use a user-defined date format so I don't know what's going on.

 


Accepted Solutions
Solution
‎07-21-2016 04:22 PM
Super User
Posts: 11,343

Re: Cannot load date formats

I bet that if you posted from the log that the error is different then you say. I will bet that the actual error is:

NOTE 484-185: Format $MMDDYY was not found or could not be loaded.

 

Note the $. Your date variable is character so any format associated with a character variable would start with $.

 

You need to create a numeric date valued variable to apply the format:

You did not state the current appearance of your date variable so I am recommending the informat which will read many character values.

 

date new;

   set old;

   NewDatevar= input(datevar,anydtdte32.);

   Format newdatevar mmddyy10.;

run;

 

View solution in original post


All Replies
Super Contributor
Posts: 436

Re: Cannot load date formats

This is weird. Your formats look like predefined ones. his can happen if the assumption about the datatype is wrong. A reference to a numeric format associated to a charcater variable can get prepended with a $, leading to a not-found message but I wonder if that's the case here.

 

Can you provide a proc contents and ssome sample records of the input dataset? Also the actual log contents would be helpful.

 

Worst case you have an issue with your SAS installation. What directories make up your SASHELP library?

 

A simple test can tell a lot. Please run:

 

data _null_;
    d='21JUL2016'd; 
    put d= mmddyy10.;
run;

The expected result would be:

d=07/21/2016

 

Regards.

- Jan.

New Contributor
Posts: 4

Re: Cannot load date formats

Posted in reply to jklaverstijn

Ok, forgive me this is going to get a little long because I have several screen shots.

First Jan, I tried your test code and it was successful:

test.png

 

Here are some sample lines of data:

sample data.png

 

Here are the log contents when I try to run the code a few different ways:

attempt1.png

 

 

Attempt2.png

 

Here is the proc contents:

contents1.png

contents2.png

Solution
‎07-21-2016 04:22 PM
Super User
Posts: 11,343

Re: Cannot load date formats

I bet that if you posted from the log that the error is different then you say. I will bet that the actual error is:

NOTE 484-185: Format $MMDDYY was not found or could not be loaded.

 

Note the $. Your date variable is character so any format associated with a character variable would start with $.

 

You need to create a numeric date valued variable to apply the format:

You did not state the current appearance of your date variable so I am recommending the informat which will read many character values.

 

date new;

   set old;

   NewDatevar= input(datevar,anydtdte32.);

   Format newdatevar mmddyy10.;

run;

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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