Learning SAS? Welcome to the exclusive online community for all SAS learners.

how to use own data in SAS university edition

Accepted Solution Solved
Reply
Contributor
Posts: 57
Accepted Solution

how to use own data in SAS university edition

Hello guys,

I am trying to use my own data-set in SAS University edition but it gives error. For example, I am trying to run this code.

Data Ab;

infile 'C:\SASUniversityEdition\myfolders\My SAS Files\9.2\China Ret\sse.ret.dat';

Input stock $1-6 date $8-13 newdate $15-19 ret;

run;

Any help will be appreciated.

Best,

cheema


Accepted Solutions
Solution
‎08-24-2016 11:31 PM
SAS Super FREQ
Posts: 8,743

Re: how to use own data in SAS university edition

Hi:

  There are 2 ways to "map" your C: drive:

1) direct (copy files into a specific physical location)

2) shortcut (define a nickname/alias for a physical location to be used as a shortcut)

  Both ways involve setup options in your Virtual Machine instructions, as follows:

1) direct method: You make a physical folder on your system called SASUniversityEdition and under that folder, you make a subfolder called myfolders. For example, on Windows, this location would be:

c:\SASUniversityEdition\myfolders the Unix equivalent of that location would be /folders/myfolders (note the Unix slashes. So if you have a subdirectory under /myfolders like this:

c:\SASUniversityEdition\myfolders\wombat then the Unix equivalent of that location would be /folders/myfolders/wombat

AND, if the wombat subdirectory had a file named sse.ret.dat, then

c:\SASUniversityEdition\myfolders\wombat\sse.ret.dat would translate to:

INFILE '/folders/myfolders/wombat/sse.ret.dat';

as described here: https://communities.sas.com/message/218581#218581 (about importing Excel files) and here about creating a library https://communities.sas.com/message/222449#222449 and using INFILE statements. Method 1 requires you to MOVE or COPY your files or CREATE your files in the folder location that has been defined to your Virtual Machine as a shared folder location.

2) The #2 method involves shortcuts. My recommendation is that you master setting up the #1 method before moving to the #2 method. You have the same issues with Unix slashes and a slightly different naming convention. And, you still have to do setup in your Virtual Machine to make the shortcut (or indirect) method work. The direction for Folder Shortcuts is here: How do I create a folder shortcut to my existing SAS files? and an example of code is shown below in #2 screen shot.
     

So the way that #2 works, is that you follow the instructions to define a shortcut in your Virtual Machine software and then you use a /folders/myshortcuts location as shown in the attached 3 screen shots. If you set up a SHORTCUT in your virtual machine of

"fred" that pointed to the physical location of c:\something\other\xyz\ and you had your sse.ret.dat in that "fred" location, then your INFILE statement would be:

INFILE '/folders/myshortcuts/fred/sse.ret.dat';

  In either case, you CANNOT use a C: drive location in the SAS University Edition, because you have a box (3) in a box (2) in a box (1)...and Box #1 is your computer (Windows or Mac) and Box #2 is your Virtualization software (either Virtual Box or VMware Player) and Box #3 is the Linux virtual machine that has SAS University Edition installed. The bottom line is that Box #3 (UE) has no visibility of the physical drives on Box #1 (your computer) unless you define them in Box #2 (the Virtual Machine software/player).

   

cynthia


_3_folder_shortcut_used.png_2_folder_shortcut_libname.png_1_folder_shortcut_manage.png

View solution in original post


All Replies
Super User
Posts: 6,946

Re: how to use own data in SAS university edition

What does the log say?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 57

Re: how to use own data in SAS university edition

Thanks for your reply. The log shows following message:

ERROR: Physical file does not exist, /opt/sasinside/SASConfig/Lev1/SASApp/C:\SASUniversityEdition\myfolders\My SAS Files\9.2\SSE

  Ret\sse.ret.dat.

Thanks,

Cheema

Super User
Posts: 6,946

Re: how to use own data in SAS university edition

First of all, you have to realize that the SAS UE is NOT windows, and therefore cannot resolve a path that starts with a drive letter or contains backslashes.

Instead you can map a windows path into the UNIX filesystem of the SAS UE virtual machine; you put your files into this windows path and use the correct UNIX syntax on the mapped path in SAS UE. This should all be documented.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 57

Re: how to use own data in SAS university edition

Thanks for your help. Could you please give me example using the command that how can I map windows path into the UNIX filesystem of the SAS UE virtual machine?

Super User
Posts: 6,946

Re: how to use own data in SAS university edition

You do that when you set up your Vurtual machine, see http://support.sas.com/software/products/university-editio/docs/SASUniversityEditionInstallGuideWind...

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
N/A
Posts: 1

Re: how to use own data in SAS university edition

What works for my sas code is to use a relative file path.  If you are trying to upload a file such as "test.dat" and it has been placed in your program directory "SASUniversityEdition/myfolders"  then the code:

  infile '~/test.dat';

should read in the file

Solution
‎08-24-2016 11:31 PM
SAS Super FREQ
Posts: 8,743

Re: how to use own data in SAS university edition

Hi:

  There are 2 ways to "map" your C: drive:

1) direct (copy files into a specific physical location)

2) shortcut (define a nickname/alias for a physical location to be used as a shortcut)

  Both ways involve setup options in your Virtual Machine instructions, as follows:

1) direct method: You make a physical folder on your system called SASUniversityEdition and under that folder, you make a subfolder called myfolders. For example, on Windows, this location would be:

c:\SASUniversityEdition\myfolders the Unix equivalent of that location would be /folders/myfolders (note the Unix slashes. So if you have a subdirectory under /myfolders like this:

c:\SASUniversityEdition\myfolders\wombat then the Unix equivalent of that location would be /folders/myfolders/wombat

AND, if the wombat subdirectory had a file named sse.ret.dat, then

c:\SASUniversityEdition\myfolders\wombat\sse.ret.dat would translate to:

INFILE '/folders/myfolders/wombat/sse.ret.dat';

as described here: https://communities.sas.com/message/218581#218581 (about importing Excel files) and here about creating a library https://communities.sas.com/message/222449#222449 and using INFILE statements. Method 1 requires you to MOVE or COPY your files or CREATE your files in the folder location that has been defined to your Virtual Machine as a shared folder location.

2) The #2 method involves shortcuts. My recommendation is that you master setting up the #1 method before moving to the #2 method. You have the same issues with Unix slashes and a slightly different naming convention. And, you still have to do setup in your Virtual Machine to make the shortcut (or indirect) method work. The direction for Folder Shortcuts is here: How do I create a folder shortcut to my existing SAS files? and an example of code is shown below in #2 screen shot.
     

So the way that #2 works, is that you follow the instructions to define a shortcut in your Virtual Machine software and then you use a /folders/myshortcuts location as shown in the attached 3 screen shots. If you set up a SHORTCUT in your virtual machine of

"fred" that pointed to the physical location of c:\something\other\xyz\ and you had your sse.ret.dat in that "fred" location, then your INFILE statement would be:

INFILE '/folders/myshortcuts/fred/sse.ret.dat';

  In either case, you CANNOT use a C: drive location in the SAS University Edition, because you have a box (3) in a box (2) in a box (1)...and Box #1 is your computer (Windows or Mac) and Box #2 is your Virtualization software (either Virtual Box or VMware Player) and Box #3 is the Linux virtual machine that has SAS University Edition installed. The bottom line is that Box #3 (UE) has no visibility of the physical drives on Box #1 (your computer) unless you define them in Box #2 (the Virtual Machine software/player).

   

cynthia


_3_folder_shortcut_used.png_2_folder_shortcut_libname.png_1_folder_shortcut_manage.png
N/A
Posts: 1

Re: how to use own data in SAS university edition

Thanks!.

N/A
Posts: 1

Re: how to use own data in SAS university edition


The method Mark.d.Haynes uses works the best if you are doing simple assignments.  It is consistent with the instruction SAS provides with the SAS UE.

N/A
Posts: 1

Re: how to use own data in SAS university edition

I am using SAS university edition on Amazon AWS.  Can I reference datasets on my computer the same way you describe?  It doesn't seem to work for me.

Super User
Posts: 6,946

Re: how to use own data in SAS university edition

To reference files on your local computer, the VM needs to run there. You may be able to reference files/directories in your virtual AWS environment, though, if you followed the instructions for a shared folder during the setup of the SAS UE VM.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
New Contributor
Posts: 2

Re: how to use own data in SAS university edition

Thanks very much Cynthia for your detailed reply. Very helpful.

N/A
Posts: 1

Re: how to use own data in SAS university edition

Your method works! Thanks!

Senior User
Posts: 1

Re: how to use own data in SAS university edition

@mark_d_haynes   I was trying to run a regression from a xyz.sas7bdat file. I tried "folders/myfolders/xyz" and "folders/myshortcuts/xyz". For myshortcuts method I created another directory and added to the shared folders in the VM. None of these methods worked. Finally I tried "~/xyz" and code ran succesfully. I would like to know what should I use instead of "~" if I want to use the other shared folder (substitute for myshotcuts). Thanks.

☑ This topic is SOLVED.

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

Discussion stats
  • 14 replies
  • 11028 views
  • 9 likes
  • 10 in conversation