BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ybz12003
Rhodochrosite | Level 12

Hello, 

I have a format code before Proc Freq.  However, an error message was shown in the log. Does the format only work in the numeric variables? Please help.

 

proc format;
	value eot_test_ce1 '82160-3'='Adenovirus' '82161-1'='Cov HKU1' '82162-9'='CoV NL63' '82163-7'='CoV 229E';
run;

Proc freq data=Sample.;
 table spec_id*eot_test_ce1 / nopercent norow nocol;
 format eot_test_ce1 eot_test_ce1.;
run;

 

ERROR: The format EOT_TEST_CE was not found or could not be loaded.
MPRINT(AAA): format eot_test_ce1 eot_test_ce1.;
MPRINT(AAA): run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Which part of CHARACTER formats start with $ did you miss?

 

proc format ;
	value $eot_test_ce1_ '82160-3'='Adenovirus' '82161-1'='Cov HKU1' '82162-9'='CoV NL63' '82163-7'='CoV 229E';
run;

and

format eot_test_ce1 $eot_test_ce1_.;

View solution in original post

5 REPLIES 5
Astounding
PROC Star

When  you create a format, the name of the format cannot end with a number.  Change the name slightly and the program should work:

proc format;
	value eot_test_ce1_ '82160-3'='Adenovirus' '82161-1'='Cov HKU1' '82162-9'='CoV NL63' '82163-7'='CoV 229E';
run;

Proc freq data=Sample.;
 table spec_id*eot_test_ce1 / nopercent norow nocol;
 format eot_test_ce1 eot_test_ce1_.;
run;
Kurt_Bremser
Super User
ERROR: The format EOT_TEST_CE was not found or could not be loaded.

seems to indicate that SAS was looking for a numeric format (no $ at the beginning of the format name), while you try to create a character format.

 

Big hint: always fix your codes top down. The first ERROR, WARNING or unexpected NOTE is the most important one. All others might be a consequence.

ballardw
Super User

Also, if the value is character the format name has to start with a $ .

 

 

You LOG would also have shown this for the proc format code:

64   proc format;
65      value eot_test_ce1 '82160-3'='Adenovirus' '82161-1'='Cov HKU1' '82162-9'='CoV NL63'
65 ! '82163-7'='CoV 229E';
ERROR: The format name EOT_TEST_CE1 ends in a number, which is invalid.
NOTE: The previous statement has been deleted.
66   run;

Replacing the final digit is not sufficient either because the values you provide are not compatible with a numeric format which the assigned behavior if the format does not start with a $.

67   proc format library=work;
68      value eot_test_ce '82160-3'='Adenovirus' '82161-1'='Cov HKU1' '82162-9'='CoV NL63'
68 ! '82163-7'='CoV 229E';
ERROR: The quoted string '82160-3' is not acceptable to a numeric format or informat.
NOTE: The previous statement has been deleted.
69   run;

ybz12003
Rhodochrosite | Level 12
eot_test_ce1 is charater variable

 Changed to 

format eot_test_ce1 eot_test_ce1_.;

Still did not work

ERROR: The format EOT_TEST_CE1_ was not found or could not be loaded.
MPRINT(AAA): format eot_test_ce1 eot_test_ce1_.;
MPRINT(AAA): run;
ballardw
Super User

Which part of CHARACTER formats start with $ did you miss?

 

proc format ;
	value $eot_test_ce1_ '82160-3'='Adenovirus' '82161-1'='Cov HKU1' '82162-9'='CoV NL63' '82163-7'='CoV 229E';
run;

and

format eot_test_ce1 $eot_test_ce1_.;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 499 views
  • 0 likes
  • 4 in conversation