Write and run SAS programs in your web browser

Error: File is in use, /folders/myfolders/ECST131/testscores.sas7bdat.

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

Error: File is in use, /folders/myfolders/ECST131/testscores.sas7bdat.

When working through the Statistics 1, demo, I received the above error message. Following are the data steps statements:

I am using the sas practice files.

 

libname statdata '/folders/myfolders/ECST131';

data statdata.testscores;
infile "/folders/myfolders/ECST131/testscores.sas7bdat";
input Gender SATScore IDNumber;
run;

 

I tried several changes but the problem is persistent. I tried to look up in other support forums and communities and tried solutions provided but the error is still there. I got the results after doing the PROC PRINT statement. 

 

Please advise if I am missing or not doing something basic. I am using SAS Studio 3.5

 

Thank you, I appreciate it.

 

Murali Sastry


Accepted Solutions
Solution
‎09-16-2016 12:00 PM
Grand Advisor
Posts: 10,210

Re: Error: File is in use, /folders/myfolders/ECST131/testscores.sas7bdat.

What are you attempting to do? That does not look like anything that would come from the demo training.

 

The line of code;

 

data statdata.testscores

says to create a data set named in statdata.

 

This line

infile "/folders/myfolders/ECST131/testscores.sas7bdat";

indicates that there is already a SAS dataset named Testscores in the STATDATA library as the path is the same as the .

 

The file is locked by SAS because the first line is making sure no process interrupts the activity you want.

 

You can access that EXISTING data set as statdate.testscores.

You could create copy or new data set using the SET, to bring in data from a SAS data set instead of INFILE which is to read external files.

 

Also try executing the code

 

data work.junk;

infile "/folders/myfolders/ECST131/testscores.sas7bdat";
input Gender SATScore IDNumber;
run;

which you may think would create a data set in the WORK library named junk.

Errors result because of assumptions about INFILE when nothing except a file name is provided. Namely that it is a text file and the Input statement expects to find blanks between the values to read. The SAS7BDAT is a binary file.

 

Try this instead:

 

data statdata.testscoresTemp;

   set statdata.testcores;

   keep gender SATScore IDNumber;

run;

proc print data=statdata.testscoresTemp;

run;

View solution in original post


All Replies
Esteemed Advisor
Esteemed Advisor
Posts: 7,203

Re: Error: File is in use, /folders/myfolders/ECST131/testscores.sas7bdat.

Well, the error message really tells you the problem.  The file testscores.sas7bdat is process locked by the system.  Do you have that file open in SAS?  Do you have it open in any other application, does someone else have it opened?  

What happens is when SAS opens a file it gets locked so that file can't be written to whilst its open.  Close the file form where ever you have it open.  You can try starting a new session, then run the code, make sure the steps you execute have completed sucessfully and you should be fine.

Solution
‎09-16-2016 12:00 PM
Grand Advisor
Posts: 10,210

Re: Error: File is in use, /folders/myfolders/ECST131/testscores.sas7bdat.

What are you attempting to do? That does not look like anything that would come from the demo training.

 

The line of code;

 

data statdata.testscores

says to create a data set named in statdata.

 

This line

infile "/folders/myfolders/ECST131/testscores.sas7bdat";

indicates that there is already a SAS dataset named Testscores in the STATDATA library as the path is the same as the .

 

The file is locked by SAS because the first line is making sure no process interrupts the activity you want.

 

You can access that EXISTING data set as statdate.testscores.

You could create copy or new data set using the SET, to bring in data from a SAS data set instead of INFILE which is to read external files.

 

Also try executing the code

 

data work.junk;

infile "/folders/myfolders/ECST131/testscores.sas7bdat";
input Gender SATScore IDNumber;
run;

which you may think would create a data set in the WORK library named junk.

Errors result because of assumptions about INFILE when nothing except a file name is provided. Namely that it is a text file and the Input statement expects to find blanks between the values to read. The SAS7BDAT is a binary file.

 

Try this instead:

 

data statdata.testscoresTemp;

   set statdata.testcores;

   keep gender SATScore IDNumber;

run;

proc print data=statdata.testscoresTemp;

run;

Occasional Contributor
Posts: 13

Re: Error: File is in use, /folders/myfolders/ECST131/testscores.sas7bdat.

Hello ballardw:

 

Your solution worked. Thank you very much. I appreciate it.

 

 

☑ This topic is SOLVED.

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

Discussion stats
  • 3 replies
  • 568 views
  • 1 like
  • 3 in conversation