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

Hello everyone, SAS beginner here. Using SAS University Edition from a Mac. I am trying to import a file "inventory.sas7bdat" by creating a library. I have used this piece of code in windows while using SAS from server. But not being able to make it work here.

Here's my code:

 

LIBNAME abcd "/folders/myfolders";
data abcd.inventory;
infile "/folders/myfolders/inventory.sas7bdat";
proc print data = abcd.inventory;

 

I am getting this error message -

 

58 infile "/folders/myfolders/inventory.sas7bdat";
 
ERROR: File is in use, /folders/myfolders/inventory.sas7bdat.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set ABCD.INVENTORY may be incomplete. When this step was stopped there were 0 observations and 0 variables.
WARNING: Data set ABCD.INVENTORY was not replaced because this step was stopped.
 
For your information:
- I am using virtual box VM
-i have checked the shared folder and the data file is inside the folder

Screen Shot 2016-10-13 at 8.55.13 PM.pngScreen Shot 2016-10-13 at 9.00.42 PM.png
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

You don't import a sas file per se. 

 

You reference it using libname.data_name. 

 

Libname abcd ... 

 

Data inventory; * dataset to be created;

set abcd.inventory; *data being used in data step;

run; 

View solution in original post

21 REPLIES 21
Reeza
Super User

You don't import a sas file per se. 

 

You reference it using libname.data_name. 

 

Libname abcd ... 

 

Data inventory; * dataset to be created;

set abcd.inventory; *data being used in data step;

run; 

shihabur
Obsidian | Level 7

I ran the code:

 

Libname abcd '/folders/myfolders';
Data inventory;
set abcd.inventory;
run;

 

It shows an error message saying "Error: the table work.inventory can not be opened because it does not contain any columns"


Screen Shot 2016-10-13 at 10.39.17 PM.png
Reeza
Super User

Yeah, your initial attempts may have wrecked your original dataset because you were trying to create that dataset (abcd.invemtory)

 

Try replacing the dataset and running the code again. 

shihabur
Obsidian | Level 7

I tried it with a different data set which I just downloaded "survey.sas7bdat" and saved it in myFolder. The dataset is fine because I can open it by clicking in SAS UE.

 

Still getting Error: ERROR: File DEF.SURVEY.DATA does not exist.


Libname def '/folders/myfolders';
Data survey;
set def.survey;
run;

 

I have even tried using a different path like /folders/myfolders/myData . But no use. Don't know if I am doing something terribly dumb !

 


Screen Shot 2016-10-14 at 11.52.47 AM.png
ballardw
Super User

@shihabur wrote:

 

Libname abcd '/folders/myfolders';
Data inventory;
set abcd.inventory;
run;

 

It shows an error message saying "Error: the table work.inventory can not be opened because it does not contain any columns"


Note that the log behind the Studio message explains to an extent what happened. You have a basically empty set.

As an example look at this code:

Data work.junk;

run;

Does not reference any external data, does not have any code but will generate the message:

NOTE: The data set WORK.JUNK has 1 observations and 0 variables.

 

Apparently you either had an empty set to begin with or the file has been corrupted. Time to find a backup.

 

Also, note that in your first post  there is a message that your ABCD library also refers to DATALIB. While there are some reasons for having multiple libraries point to the same location you really shouldn't be attempting any of them at this stage of learning. Use the existing DATALIB or create a subfolder such as /folders/myfolders/project and reference that for your data related to a project. One of the purposes of a library is to organize things that belong together. So you may have all of the datasets related to your inventory project in one library and party planning in a different library.

 

shihabur
Obsidian | Level 7

Hi, Thanks for detailed response. I understand that my situation is a similar to where there would be an empty/corrupt file. I just downloaded a different file "survey.sas7bdat" and tried again but only to get same result. I opened the file by clicking and it seems fine as you can see in the attached image.

 

Secondly, I think I have made this mistake of creating too many libraries, probably i should have sticked to only one instead of creating a new one everytime I am running the code. But could that be reason for my problem ?


Screen Shot 2016-10-14 at 11.54.56 AM.png
ballardw
Super User

What code did you run and what do you mean by "same result"? if you ran a data step agains the survey data set DON'T.

shihabur
Obsidian | Level 7

I ran this code:

 

Libname def '/folders/myFolders';
Data survey;
set def.survey;
run;

 

And got this error:

 

ERROR: File DEF.SURVEY.DATA does not exist.

 

 

What do I do now ?

Reeza
Super User

Assign your library.

 

library test '/folders/myfolders/';

 

proc datasets lib=test;

run;quit;

 

Post the output from the code above please.

 

Is this a new install of SAS UE?

 

Can you show the set up of myfolders in your folder as well?

 

 

shihabur
Obsidian | Level 7

I installed UE 2 months back. I am attaching the image of how the shared folder looks like now. Turns out as of this moment the correct file path is "/folders/myshortcuts/myFolders"


Screen Shot 2016-10-14 at 1.47.06 PM.png
Reeza
Super User

This is because you used myFolders vs myfolders. SAS UE is on unix and is case sensitive. If you create the folder (myfolders) as noted in the instructions you're original code would have worked. 

 

In general, SAS UE examples tend to rely on myfolders so I would consider creating that folder and adding it correctly. 

 

 

shihabur
Obsidian | Level 7

I ran the piece of code you asked to run and this is the log.


Screen Shot 2016-10-14 at 1.50.47 PM.png
shihabur
Obsidian | Level 7
Now I understand. That's why I am seeing this "A shared folder named "myfolders" was not found on the virtual machine" on SAS University Edition Information Center. How I do it now ? I mean how do I change the file path to /folders/myfolders/ ?
Reeza
Super User

I woud rename your folder to myfolders - all lower case. 

Then readd it as a shared folder and restart your virtual machine. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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