BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

Hidden in the middle of that picture you posted as this:

Tom_0-1720465769932.png

Do you only have trouble with SAS not releasing the lock on the XLSX file  when you get that ERROR message about the WHERE= dataset option?  (NOTE: Since it is SAS code that is touching the XLSX file the fact that you are using Enterprise Guide to submit the code is probably unrelated to the cause.  The symptom you mention of the file getting freed with EG is closed is probably a side effect of EG closing the SAS session it is using to run the SAS code.  Next time it locks a file try just telling EG to restart the SAS session and see if it frees the lock.)

 

What happens if you change your code to NOT use the WHERE= dataset option in the step that is accessing the XLSX file?

proc import .... out=WORK.xxx ....;
data WANT; set work.xxx;
  where PPI=1;
run;

Or change the way the WHERE= condition is coded so that the TYPE of the variable being referenced does not matter?

where=(cats(PPI)='1')

 

AlanC
Barite | Level 11

Tom suggested, in an earlier post, to release the filename. I didn't see that after cursory review. Have you tried it?

 

filename myFile 'blah, blah' ;

proc import...;

filename myFile; <== Do you have this in place?

https://github.com/savian-net
Michael_W
Calcite | Level 5
Yes, it's only SAS and I agree that it's unrelated to EG ..now that I just discovered that I can replicate the issue using SAS Studio. If I remove the WHERE the code will work as it assign the type based on value in that column on the Excel spreadsheet, but that is not what I need my code to do. The first row of the Excel file is used to establish the field/column types and then the same spreadsheet is used by process in two different places; one where the PPI EQ 1 and the other where the PP1 EQ 2. The fix to the problem is easy once the file is unlocked; either update the WHERE to PPI EQ '1' or remove the quote preceding the PPI value on the first row of the worksheet. Resolving my issue in that manner, while it fixes my issue, it doesn't explain or address the problem when it reoccurs (which is SAS locks PC files when this type of error occurs upon import attempt).
I do appreciate your assistance and I am not trying to be challenging, I am just trying to figure why SAS is doing this .. because this type of use case will happen again and I will have to shut EG or SAS Studio completely just to free up the file.
MarkAllemang
SAS Employee

@Michael_W  - I understand and you are correct about needing to get the root issue solved. I'm not involved with the implementation of the procedures like PROC IMPORT, so that is why I suggest reopening your track with this new info. They will be able to get the right people involved to find out the root cause. When you open the track, indicate it is in SAS Foundation, instead of starting with the EG support.

 

Glad to help. Hope they are able to resolve it quickly.

Michael_W
Calcite | Level 5
Definitely. And thanks for all of the tips and advice.
AlanC
Barite | Level 11

Well, you could also consider doing it w/o using PROC IMPORT. ODBC, OleDB are both viable as well.

 

If the formats, formulas, styles, etc. don't matter, treat Excel as a data source.

 

 

https://github.com/savian-net
Quentin
Super User

@AlanC wrote:

Well, you could also consider doing it w/o using PROC IMPORT. ODBC, OleDB are both viable as well.

 

If the formats, formulas, styles, etc. don't matter, treat Excel as a data source.

Also as in my suggestion earlier in the thread, libname statement with XLSX engine may work and allows you to manually release the lock by clearing the libref.  

The Boston Area SAS Users Group (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 51 replies
  • 2677 views
  • 18 likes
  • 8 in conversation