Sas workspace on SaS EG - sas

We have default SAS workspace of x TB. We also have alternate 10X TB workspace on same server at different folder location.
Can anyone please help me with syntax that can be used in SAS EG to point to the alternate workspace instead of default one?

The SAS work directory can be changed for individuals by creating a $HOME/sasv9.cfg file and placing one line in it:
-WORK {full path to the SAS work directory}

if you are running in unix, you can change the work directory in the execution. nohup sas -work /myworkdirectory mypgm.sas &

Are you referring to the SAS work library, which is the location where SAS lets you store temporary data sets?
If so, then it depends. Are you using EG to in a client/server setup? In that setup you will have to get your SAS Admin to make changes on the server or in the SAS Metadata to point the work library for all Workspace Servers that start to use the other location that has more available space.

Would you not define SAS libraries out of these workspaces?
i.e. libname mydata '/folders/myfolders/'
This will then assign each library to your active SAS session.
Use this as precode to any manipulation your doing.
If you have Management Console, or Using PROC METADATA you can create permanent libraries.

You mentioned workspace, so I assume you need to control the WORK library.
Use the SAS system option
options work=library-specification
In the SAS documentation it states: specifies the libref or physical name of the storage space where all data sets with one-level names are stored. This library must exist.
Make sure the the file space is "close" to where the processing is done or file transfer will be a bottleneck.

Related

SAS - How to configure sas to use resources from local disk other than local disk C:

Basically when I do sorting or join table in sas, the sas will use resources / space from local disk C: to process the code, but since I only have 100GB left on local disk C:, It will result in error whenever SAS was out of resources.
My question is how to configure / change the setting in SAS to use resources from Local Disk E: instead, since I have larger space there.
I already looking through the forum, but found no similiar question.
Please Help.
Assuming you are talking about desktop SAS, or a server that you administer, you can control where the work and utility folders are stored in a few ways.
The best way is to use the -work and -utilloc options in your sasv9.cfg file. That file can be in a few places, but often the SAS Shortcut you open SAS with specifies it with the -CONFIG option. You can also set the option in that shortcut with -WORK or -UTILLOC command line options. The article How SAS Finds and Processes Configuration Files can help you decide the location of the sasv9.cfg you want to modify; if you are using a personal copy on your own laptop, you may change the one in the Program Files folder, but if not, or if you don 't have administrative rights, you have other places you can place a config file that will override that one.
A paper that discusses a few of these options is one by Peter Eberhardt and Mengting Wang.
One way is to set up a library named user for projects that will be time intensive and this way you get it to be dynamic as needed. When you have a library called user, that becomes the default workspace instead of work. But, you need to clean up that library manually, it won't delete data sets automatically when you're done with it.
libname user '/folders/myfolders/demo';
As #Tom indicates, you can also set an option to use a library that already exists if desired.
options user = myLib;
An advantage of this method over the config file method as it only does it for projects where it's needed, rather than your full system.

Change temporary file directory in SAS

I need to use PROC.SQL statements for my analysis. The problem is, SAS uses C disk in order to create temporary files when I use SQL statements. My datasets are very large and I do not have enough space for that. Could you please explain me how to allocate this temporary file in other place rather than C disk?
You want to change the WORK system option. You can do:
c:\sas\sas.exe -work d:\temp
to use the d:\temp directory.
You can also use the OPTIONS statement within the config file used when starting SAS (thanks Tom):
options work='d:\temp'
See also:
Indiana University answer for SAS on UNIX systems.
SAS 9.2 documentation on system options.
Create a 'user' library instead. When a USER library is in effect, all one level datasets are written to this directory and it's used as the default instead of WORK library.
libname user 'path to other location';
If you want to permanently change sas work location, you can set it in sasv9.cfg. (Default location: C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg). Along with -WORK, you may also want to change the value for -UTILLOC option.
You can even spread a Load across Multiple Volumes of Different Disks. Please read Example 1 mentioned in this link - https://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#n1qr5dmzagn9krn1lt1c276963za.htm

Remove standard SAS libraries from GUI

I'd like to remove/delete/unassign the standard SAS libraries from my SAS 9.3 GUI.
I've tried two solutions to remove a library which haven't worked:
%sysfunc(libname(maps)) results in:
ERROR 180-322: Statement is not valid or it is used out of proper order.
Comment out the offending start up code in the file sasv9.cfg
I don't have permission to modify (C:\Program Files...) files in that directory
Thanks!
The libraries are:
- Maps
Mapsgfk
Mapssas
Sashelp
Sasuser
You can remove the map related libnames, at the cost of not having the map files available to you and possibly losing some functionality.
If you copy your basic config file to some other location, either to one of the predefined locations mentioned in Files Used By SAS for your operating system (I link to the Windows version here, but Unix has a similar page); or to a location specified on the -CONFIG option in your shortcut, like for example:
"C:\Program Files\SAS94\SASFoundation\9.4\sas.exe" -CONFIG "C:\temp\sasv9_nolibs.cfg"
You can do this without having write access to the Program Files directories where the config files are usually stored. If you do that, you can then customize it by removing the -MAPS and related lines. Then those libraries will not be created; in that case, only SASHELP, SASUSER, and WORK are created, as follows:
Removing SASUSER does not seem to be possible, as while you can remove the -SASUSER option in the config file, it will still create the SASUSER folder.
Removing the -SASHELP option will unfortunately cause SAS to crash on initialization; SASHELP contains many core files for SAS functionality and SAS cannot work without it. See the following screenshot.
As such, you can get down to 3 libraries, but not further.
You got the 180-322 because the libname function returns a value and you call it in open code and the code it generated is not valid.
29 %put NOTE: %sysfunc(libname(maps));
NOTE: -630193
Do as above an you will see the value. However it looks like you cannot clear LIBREF MAPS.
Not sure if you can remove them without changing your system wide config.sas file. But you could point the MAPS options to null devices so that they don't find any datasets. Here is output from PROC OPTIONS.
MAPS=!SASROOT/maps
Specifies the location of SAS/GRAPH map data sets.
MAPSGFK=!SASROOT/mapsgfk
Specifies the location of GfK maps.
MAPSSAS=!SASROOT/maps
Specifies the location of SAS map data sets.
You can point these two different locations with command line options.
sas -maps /dev/nul -mapsgfk /dev/nul -mapssas /dev/nul
The libref will still be created but there won't be any members found.
You might do something similar for SASUSER, but then you would probably also want to add -rsasuser option so that SAS would know to create a WORK.PROFILE to use in place of the normal SASUSER.PROFILE catalog.
I don't think you would want to remove SASHELP libref as I think there are a number of things in SAS that would not work without being able to find things that are made available via that libref.

Error in reading SAS files

I am just playing around with SAS, writing the following code
options nocenter nonumber;
data vag;
infile "C:\Users\Deborah\Desktop\School\STA 318\book\veggies.txt";
input Name $ Code $ Days Number Price;
CostPerSeed = Price / Number;
run;
The location of the file is correct, but the error I am getting
ERROR: Physical file does not exist, /opt/sasinside/SASConfig/Lev1/SASApp/C:\Users\Deborah\Desktop\School\STA 318\book\veggies.txt.
What can I do to fix this?
You are working on Unix server, not you local PC. While you are running a local client on your PC (like SAS EG), you can't actually access local resources on your local PC because these resources needs to be made available to Unix box itself.
You have four options:
1. Use an import Wizard in SAS EG. It will generate a data step and will use hidden SAS EG methods to convert your text file and move it as a data set to Unix server where you then can create variables that you want.
See if your file system is available to you in SAS EG. Expand your workspace server. You should see "files". Expand to the folder that you are allowed to use and drag&drop your text file into there.
Upload files to the unix server using whatever file transfer method is available. Usually you would have some sort of FTP server running.
Also, as Joe suggested, you can install this custom task http://blogs.sas.com/content/sasdummy/2012/12/06/copy-files-in-sas-eg/
It can do a lot better job that step 2 or 3 because it can be part of your process, resolve macro variables and fix file formatting issues between Windows and Unix. Thanks Joe!!

Change work library to D drive for SAS EG 5.1

Hi I don't have much space on my C drive so I'm looking to move my work library for SAS EG 5.1 over to a folder on my D drive. How could I do this?
Thanks!
Presuming you are using EG to work locally, you can change it in your sasv9.cfg file:
This is usually found in the SASFoundation/nls/en (or equivalent language) directory.
Another option (which avoids changing the config file) is to change the value of the TEMP environment variable. Remember though that SAS is I/O heavy, and if the D drive is a remote network location you may suffer performance-wise..
An option if you're unable to modify the Config file, is to define a USER libname:
libname user "d:\saslib\";
or similar. That will become your default one-level libname (ie, if you say data have; that will now be stored in user.have, not work.have). It doesn't override it if you have specified work explicitly, and it doesn't automatically clean up after itself, so be aware of these issues.