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

G'day.

 

I have placed a filename near the end of a SAS program  and am getting the following error message: 

ERROR: At least one file associated with fileref IMPORT is still in use.
ERROR: Error in the FILENAME statement.

This is the filename code. When I run the file SAS program.sas by itself, I don't get an error statement. Howeber, when I run the program the code below sits in, I get the error statement.

filename importv 'C:\SAS Programs\SAS program.sas';
%include importv;

Any help you can give will e much appreciated.  Thank you.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

What is the name of the the program file that contains the shown statements? IF that name is

 'C:\SAS Programs\SAS program.sas';

then it is open in the editor and is used by the editor.

 

If the program that contains those two lines has a different name then possibly another program is attempting to us SAS Program.sas.

 

Or possibly one or more of the statements inside the file when %included is in use. You may have to examine the contents of SAS Program.sas to see what external files may be used. Example: if that program is supposed to read another file that is open in the editor you could get that message.

 

Please, in the future if you are going to show an ERROR do not separate it from the rest of the code. Include from the log the entire data step, procedure or other statements that are related to causing the error.

View solution in original post

5 REPLIES 5
ballardw
Super User

Are you trying to do some thing with the file that is active in the editor? Then the Editor has the file "in use".

jcis7
Pyrite | Level 9

Can you help me understand:  When you ask, am I trying to do something with the file that is active in the editor,  do as you asking if  I  am trying to use a file that was created in the sas program that the filename statement is at the end of? Or are you asking if I'm trying to do something with the SAS program file that is in the filename statement?

 

Based on your question, I selected the 'Break' button to cancel anything that had been running. Then I reran the program that the filename statement is at the end of, and no error came up.  

 

Then, I closed SAS, reopened it and the program ran with no errors including the filename import statement at the end. I am trying to figure out if I'm doing something wrong and not do it again in the future. Thank you.

ballardw
Super User

What is the name of the the program file that contains the shown statements? IF that name is

 'C:\SAS Programs\SAS program.sas';

then it is open in the editor and is used by the editor.

 

If the program that contains those two lines has a different name then possibly another program is attempting to us SAS Program.sas.

 

Or possibly one or more of the statements inside the file when %included is in use. You may have to examine the contents of SAS Program.sas to see what external files may be used. Example: if that program is supposed to read another file that is open in the editor you could get that message.

 

Please, in the future if you are going to show an ERROR do not separate it from the rest of the code. Include from the log the entire data step, procedure or other statements that are related to causing the error.

Tom
Super User Tom
Super User

To see more detail in the SAS log use the SOURCE2 option.  Either set it with an OPTIONS statement or include it in the %INCLUDE statement.

%include importv / source2;

 

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