BookmarkSubscribeRSS Feed
Catherine8
Calcite | Level 5

Hi,

 

I have downloaded and followed all the steps for using and setting up SAS University Edition. I am using the book, Learning SAS by Example to familiar myself with the program. I downloaded the example data sets that goes along with the book and saved them to my computer. When I open SAS studio, the files are all there. They appear to be shared files when I check properties on my computer. I can open, for example a txt file and see the data on studio. I am trying to do one of the exercises in the book using the data that goes along with it.

This is the syntax from the book:

 

data Demographics:

   infile"C:\books\learning\Mydata.txt";

   input Gender $ Age Height Weight;

run;

The next image is my actually syntax. The next image shows the infile location on studio. And the last is the error message that pops up. So, why the error message? What am I doing wrong?

6 REPLIES 6
Reeza
Super User
You may be better off starting with the Free SAS e-course which gets you familiar with SAS Studio. However your question is pretty common.

If you can see the file in SAS studio, under the Servers Files and Folders pane, right click the file, select properties and use the path from there.

SAS UE runs on a virtual machine. It cannot see your desktop except for what you set, which you do via the myfolders folder, that you set up during the installation process. You can also set up other shared folders but you have to explicitly do it. And then you need to use the path that the VM sees, which is a unix file path. Hope that clears things up and good luck!
Catherine8
Calcite | Level 5

I am using the path listed under select properties for the file, not the one from the book example, because that path doesn't actually exist. You can see that the file exists on studio, it opens and contains the text. My folders and files that I am trying to use are shared. If they weren't, I don't think I could open this specific text file. In the one photo, you can see that the data file is available in my studio. What else could be the issue? Is it my syntax? Is there another way that I need to set it up for share?

Reeza
Super User
I can't download attachments, you'll need to post your code and images - use the camera icon in the editor. That path cannot be correct, it's in Windows and you need Unix paths. You have to do the steps I indicated, find the path in the Servers files and folders pane and select it from there. SAS UE cannot see your C drive.
Catherine8
Calcite | Level 5

I think maybe I am not giving enough details on how everything is set up and what I am already doing. So here we go. First off, I am using a Mac Book and SAS University Edition.

 

I am using Cody’s Learning SAS by Example. On page 9 of the 2nd edition, he lists a raw data file Mydata.txt. This is what it contains:

 

M 50 68 155

F 23 60 101

M 65 72 220

F 35 65 1330

M 15 71 166

 

The program syntax he uses is listed as follows:

 

data Demographic;

            infile “C:\books\learning\Mydata.txt”;

            input Gender $ Age Height Weight;

run;

 

In order to do this problem myself, I downloaded this and all other data files that go with the book at support.sas.com/cody.

 

On my physical computer, I have one main folder, listed as SASUniversity Edition. There is a subfolder to it titled 71442_example. In that folder, I have access to the Mydata.txt file mentioned above. I can open and close it and it contains the same raw data as the example above. The folders I just mentioned are marked as “shared folders” and the Mydata.txt file is NOT marked as locked.

 

When I go to virtual machine, the main folder, listed above, and I assume all subfolders, are listed as a shared folder. It is set to Full Access and is in Auto Mount. If I put my mouse arrow on it, a textbox appears that reads:

 

“List all shared folders accessible to this machine. Use ‘net use x: \\vboxsvr\share' (note* this shouldn't be underlined but its showing up like that here) to access a shared folder named share from a DOS-like OS, or ‘mount -t vboxsf share mount_point’ to access it from a Linus OS. This feature requires Guest Additions."

 

When I go to SAS Studio, listed under my Folder Shortcuts is the folder SASUniversity Edition and a subfolder, 71442_example. I’m assuming I have successfully shared these folders from my physical computer to SAS Studio, since they are visible on SAS Studio. In the 71442_example folder, I can locate the file, Mydata.txt and open it. When I check the properties, it lists this:

 

Name:             Mydata.txt

 

Type:               File

 

Location:         /folders/myshortcuts/SASUniversityEdition/71442_example/Mydata.txt

 

Size:     63 Bytes

 

Date modified: Jul 12, 2019, 2:55:18 PM.

 

Trying to follow the example from Cody, listed above, I write the following syntax:

 

data Demographic;

            infile “C:/folders/myshortcuts/SASUniversityEdition/71442_example/Mydata.txt”;

            input Gender $ Age Height Weight;

run;

 

Here is the log:

 

1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

 72        

 73         data Demographic;

 74         infile “C:/folders/myshortcuts/SASUniversityEdition/71442_example/Mydata.txt”;

                        _

                        23

 ERROR 23-2: Invalid option name :.

 

 74       ! infile “C:/folders/myshortcuts/SASUniversityEdition/71442_example/Mydata.txt”;

                          _______

                          23

 ERROR 23-2: Invalid option name FOLDERS.

 

 74       ! infile “C:/folders/myshortcuts/SASUniversityEdition/71442_example/Mydata.txt”;

                                  ___________

                                  23

 ERROR 23-2: Invalid option name MYSHORTCUTS.

 

 74       ! infile “C:/folders/myshortcuts/SASUniversityEdition/71442_example/Mydata.txt”;

                                              ____________________

                                              23

 ERROR 23-2: Invalid option name SASUNIVERSITYEDITION.

 

 74       ! infile “C:/folders/myshortcuts/SASUniversityEdition/71442_example/Mydata.txt”;

                                                                        ________

                                                                        23

 ERROR 23-2: Invalid option name _EXAMPLE.

 

 75         input Gender $ Age Height Weight;

 76         run;

 

 NOTE: The SAS System stopped processing this step because of errors.

 WARNING: The data set WORK.DEMOGRAPHIC may be incomplete.  When this step was stopped there were 0 observations and 4 variables.

 NOTE: DATA statement used (Total process time):

       real time           0.00 seconds

       cpu time            0.01 seconds

      

 

 77        

 78        

 79        

 80         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

 92        

 

So what is not set up right? The syntax? The folders? Both?

 

 

 

 

Tom
Super User Tom
Super User

So you asked SAS/Studio what the name of the file was and it told you

Location:         /folders/myshortcuts/SASUniversityEdition/71442_example/Mydata.txt

So just use that name in your code.

 infile '/folders/myshortcuts/SASUniversityEdition/71442_example/Mydata.txt';

But I am really surprised to see "myshortcuts" listed as if it is a real folder on Unix and not just a "shortcut" that is used in the navigation pane in the SAS/Studio interface.

 

Normally in UE everything is under 

/folders/myfolders/

 

Your error messages are also not correct for a simple mistyped path.   Are you sure you are using real " characters in your INFILE statement and not the "smart" quotes that word processors like to convert them into?  if not then perhaps you have submitted some unbalanced quotes and SAS is getting confused about how to parse your code.  You might need to restart your SAS session to clear that up.

Reeza
Super User
Tom, you can create custom locations in SAS UE and they're found under the my shortcuts sections. This is nice if you're working on projects and don't want to move all your files to my folders you can just create another shared folder to the actual folder on your desktop. So 'myshortcuts' is used for any custom folder besides myfolders.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 2088 views
  • 0 likes
  • 3 in conversation