BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
HitmonTran
Pyrite | Level 9

Hi all,

 

I know there's a few posts regarding this topic but none has worked in my situation. 

 

 

I get a log message for date9, format:

 

20 ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
21
22 GOPTIONS ACCESSIBLE;
23 data adsl1;
24 merge adsl(in=a)
25 ecall
26 ;
27 by studyid usubjid;
28
29
30 ***col6;
31 ecstdtc_=substr(ecstdtc,1,10);
32 col6= strip(put(ecstdtc_, date9.));
______
484
NOTE 484-185: Format $DATE was not found or could not be loaded.

33 run;

data: 

dates.PNG

 

 

code:

data adsl1;
  merge adsl(in=a)
		ecall
		;
  by studyid usubjid;
 

	 ***col6;
	 ecstdtc_=substr(ecstdtc,1,10);
	 col6= strip(put(ecstdtc_, date9.));
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

So you took the first 10 characters of a string and tried to use the PUT() function to apply a NUMERIC format to it. SAS very kindly assumed you just forgot to include the $ in your format specification and so it added one. But then it could not find any character format named $DATE.

 

Do you want to create a DATE value? 

col6 = input(ecstdtc, yymmdd10.);
format col6 date9.;

Or do you want to create another string that also looks like a date, only this time showing the date in a different style?

col6 = put(input(ecstdtc, yymmdd10.),date9.);

 

View solution in original post

9 REPLIES 9
PeterClemmensen
Tourmaline | Level 20

please post the code that generated this log?

HitmonTran
Pyrite | Level 9
Hi Draycut,

I updated the post.
PaigeMiller
Diamond | Level 26

Please run PROC CONTENTS on data set adsl and SHOW US if this variable ecstdtc is numeric or character.

--
Paige Miller
ballardw
Super User

@HitmonTran wrote:

Hi all,

 

I know there's a few posts regarding this topic but none has worked in my situation. 

 

 

I get a log message for date9, format:

 

 


662 col5= strip(put(rficdt, date9.));
663 
664
665 ***col6;
666 *if BRTHDTC ne "" then BRTHDT= input(substr(strip(BRTHDTC),1,10),is8601da.);
667 col6= strip(put(BRTHDTC, date9.));
______
484
NOTE 484-185: Format $DATE was not found or could not be loaded.

 

data: 

dates.PNG

 


Please describe what you are attempting to do. In considerable detail.

 

Your Brthdtc variable appears to be a character value that looks like a year. As such it is inappropriate to attempt to use a date valued format like date9 in any form. Also if the value is only a year then what date of a year would you want that to represent??

PaigeMiller
Diamond | Level 26

Since your date variable RFICDT is already formatted as date9., there doesn't seem to be much point in turning it into a character string. Any time SAS has to use this variable, it will ALWAYS display it as date9. 

 

So the answer to your problem is to do nothing. Write no code! Problem solved.

 

Unless there's something you haven't explained as to why you need a character string here.

--
Paige Miller
HitmonTran
Pyrite | Level 9
Hi Paige,

I updated the post with another example. Can you please take a look? Thank you
PaigeMiller
Diamond | Level 26

@HitmonTran wrote:
Hi Paige,

I updated the post with another example. Can you please take a look? Thank you

As others have asked, would you please explain why you are doing this if you already have a string of text (either a formatted number or an actual character string) that appears to be in DATE9. format?

--
Paige Miller
Tom
Super User Tom
Super User

So you took the first 10 characters of a string and tried to use the PUT() function to apply a NUMERIC format to it. SAS very kindly assumed you just forgot to include the $ in your format specification and so it added one. But then it could not find any character format named $DATE.

 

Do you want to create a DATE value? 

col6 = input(ecstdtc, yymmdd10.);
format col6 date9.;

Or do you want to create another string that also looks like a date, only this time showing the date in a different style?

col6 = put(input(ecstdtc, yymmdd10.),date9.);

 

HitmonTran
Pyrite | Level 9
Thanks Tom! the second option is what I wanted!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 9 replies
  • 4609 views
  • 1 like
  • 5 in conversation