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

I have transitioned over from SAS Studio to SAS 9.4 and am running across an error where all the variables have an error of "NOTE: Format XXX was not found or could not be loaded" even though I am using the options nofmterr line before my code. Can someone assist with this? Here is my code: 

libname PUF 'G:\Research Labs\XXXX\XXXX TQIP PUF\Raw Data\PUF 2017\SAS'; 
 
options nofmterr;
data PUF2017;
set PUF.PUF_TRAUMA;
rename inc_key = patientID;
KEEP patientID ageyears sex asian pacificislander raceother americanindian black white race_na race_uk;
run; 
 
Here is my log as well:

118 options nofmterr;
119 data PUF2017;
120 set PUF.PUF_TRAUMA;
121 rename inc_key = patientID;
122 KEEP patientID ageyears sex asian pacificislander raceother americanindian black
122! white race_na race_uk;
123 run;

NOTE: Format SEX was not found or could not be loaded.
NOTE: Format BIU was not found or could not be loaded.
NOTE: Format YN was not found or could not be loaded.

So on & so forth...

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

The option NOFMTERR lets SAS run without stopping the program when  format is attempted that is not available. Otherwise your data step would halt with an ERROR from the formats not found.

 

If you do not want those messages to appear you could clear the apparent format association in the source data set PUF.PUF_Trauma if you control the data set. That isn't friendly if someone else controls the set.

 

To prevent these messages from appearing when you use PUF2017 you could add a format statement to clear the associations but will get the same notes using the set that still has the association.

data PUF2017;
set PUF.PUF_TRAUMA;
rename inc_key = patientID;
KEEP patientID ageyears sex asian pacificislander raceother americanindian black white race_na race_uk;
format;
run; 

 

 

View solution in original post

10 REPLIES 10
PaigeMiller
Diamond | Level 26

Probably this data set was created with formats. You either need to access those formats (contact the person who created that data set) or run this command before you try to access this data set.

 

options nofmterr;
--
Paige Miller
PunkinSAS08
Fluorite | Level 6

the options nofmterr; was included in the SAS code I provided and I am still experiencing the error. 

Reeza
Super User

@PunkinSAS08 wrote:

the options nofmterr; was included in the SAS code I provided and I am still experiencing the error. 


You're getting a NOTE not an error. This means your code should work as expected.

 

 

ballardw
Super User

The option NOFMTERR lets SAS run without stopping the program when  format is attempted that is not available. Otherwise your data step would halt with an ERROR from the formats not found.

 

If you do not want those messages to appear you could clear the apparent format association in the source data set PUF.PUF_Trauma if you control the data set. That isn't friendly if someone else controls the set.

 

To prevent these messages from appearing when you use PUF2017 you could add a format statement to clear the associations but will get the same notes using the set that still has the association.

data PUF2017;
set PUF.PUF_TRAUMA;
rename inc_key = patientID;
KEEP patientID ageyears sex asian pacificislander raceother americanindian black white race_na race_uk;
format;
run; 

 

 

PunkinSAS08
Fluorite | Level 6

Will this affect the rename line in my code? The patientID variable and inc_key cannot be found in the dataset now. 

Reeza
Super User

Try changing your KEEP statement to keep the new variable name, not the old variable name.

 


@PunkinSAS08 wrote:

Will this affect the rename line in my code? The patientID variable and inc_key cannot be found in the dataset now. 


 

PunkinSAS08
Fluorite | Level 6
The KEEP statement includes the new variable: data PUF2017;
set PUF.PUF_TRAUMA;
rename inc_key = patientID;
KEEP patientID ageyears sex asian pacificislander raceother americanindian black white race_na race_uk;
format;
run;
Reeza
Super User
Then try the opposite 🙂

Sorry, I program in both R/SAS and they're slightly different in how the rename works (opposite sides of the equal sign :))
Tom
Super User Tom
Super User

@PunkinSAS08 wrote:
The KEEP statement includes the new variable: data PUF2017;
set PUF.PUF_TRAUMA;
rename inc_key = patientID;
KEEP patientID ageyears sex asian pacificislander raceother americanindian black white race_na race_uk;
format;
run;

You are telling SAS that when it writes PUF2017 it should rename INC_KEY as PATIENTID.  But then you tell to NOT write INC_KEY by not including it in the KEEP statement.

 

A mnemonic to help keep this straight is that DROP/KEEP and RENAME are applied in alphabetical order.

 

Here is an example that demonstrates. Notice how TEST is created with ZERO variables since NAME2 was not the name of any variable in the data step.  

 

1217  data test;
1218   set sashelp.class;
1219   rename name=name2;
1220   keep name2;
1221  run;

WARNING: The variable name2 in the DROP, KEEP, or RENAME list has never been referenced.
WARNING: The variable name in the DROP, KEEP, or RENAME list has never been referenced.
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.TEST has 19 observations and 0 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

 

PunkinSAS08
Fluorite | Level 6

This helped so much! I never knew this. Thank you

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
  • 10 replies
  • 1318 views
  • 2 likes
  • 5 in conversation