I'm running SAS EG 7.1 on a Citrix machine at work. I'm trying to do a very large sql pull and keep running out of disk space. Our server drive has plenty of storage, so I assume switching the working directory to a folder on that drive temporarily will avoid this error?
The error says "insufficient disk space....file is damaged. I/O processing did not complete. You may be able to execute sql statement successfully if you allocate more space to the WORK library." I don't seem to have access to the config file and I've tried to change it programmatically with no luck. I am trying to save the resulting dataframe to a server folder already with a LIBNAME statement, but I think the temporary files created in WORK during the process are too much to handle. Any help?
I've tried both:
x 'cd "Q:\folder"';
and
data _null_;
rc = system( 'cd "Q:\folder"' );
if rc = 0
then putlog 'Command successful';
else putlog 'Command failed';
run;
These run fine, but in the log it still says my working directory is unchanged:
SYMBOLGEN: Macro variable SASWORKLOCATION resolves to "C:\Users\user\AppData\Local\Temp\SEG5432\SAS Temporary
Files\citrixMachineDrive\Prc2/"
The current directory is relevant for file references and such, but it's not related to your Work or Util directories.
WORK and UTIL are only settable at startup, and are either set in the arguments for sas.exe or in the sasv9.cfg configuration file. How you solve your particular problem depends on whether EG is connecting to a SAS server, or if it's just running locally. If it's running locally, you may be able to modify the startup options. If it's connecting to a server, you will have to talk to your SAS administrator.
However, it's highly unlikely you would want to use the network folder as your WORK folder. SAS expects high speed disk connected directly to the machine for WORK; if you set it to a network drive, your performance would be extremely poor.
Also note that "C:" is on the machine the SAS server is running on - it might be the same machine, if you're running SAS locally (on Citrix), but if it's a remote SAS server then the C:\ is on that server.
Related
When running SAS through EGuide locally I can successfully declare a libname as follows:
libname winlib '\\pc\folder\';
When using a SAS server this is not possible and I have to resort to using a Copy Files task.
For interest:
I believe this is because of the fact that the SAS server is Unix, is this correct?
What I've tried:
libname test '//pc/folder/'
libname test2 'smb://pc/folder/'
The other options I can think of is mounting the drive to the SAS server, this isn't viable for me as this is for ad-hoc cases.
The question:
How would I correctly declare a libname to \\pc\folder for the SAS server?
A few notes:
I cannot run locally as I have to connect to a few DBs, and I don't want to use a PROC UPLOAD or DOWNLOAD for this.
If you want SAS to read a directory then the SAS process needs to be able to see the directory.
What most companies do is create a shared directory that can be mounted by both the SAS machine and your PC then you can reference the files directly from both, just using different paths.
Otherwise if you want SAS to use a file that EG can see but SAS cannot then I suggest asking EG to upload the file. There are custom tasks available for EG to upload binary files.
Another method would be to create SAS code to connect to a machine that can see the files and pull the files over. Perhaps using FTP or SFTP protocol.
Unfortunately there is no way to do this in the manner I wish (directly using the remote path in the libname statement in a Unix environment).
You should be able to do this with a Windows SAS server and can do it with the local windows SAS server.
This is due to how Unix works, meaning one would have to mount the share.
That isn't feasible as an ad-hoc method.
I do wish Unix had a more direct way of accessing remote directories.
That being said, alternatively one can do one of the following:
write the data to a server-local directory, even work or home. Then Copy the data to a local directory. (by using Copy Files task in Enterprise Guide for example, or copying them manually if you have access to the location from your local PC)
Do the SAS processing locally and fetch the needed data over the network (this isn't feasible if you need DB access, which can't be done on the local server)
Get whoever is in charge of your SAS server's to set up a mount that's accessible from both your machine and the SAS server.
Use SAS PC files Server to accomplish this for M$ office files.
Setup an FTP server on your local machine and use a filename with the FTP option to read/write to it. see How do I read raw data via FTP in SAS? for an idea.
Thanks to #Tom for the suggestions.
Is there a way to run SAS using batch if I don't have the sas.exe in my machine?
My computer has the SAS EG but the code is ran on our companies servers
Thanks
If you are asking whether it is possible to run SAS batch on your local machine without having SAS on your local machine, the answer is no.
If you are using EG to connect to a SAS server, and you want to execute a batch job on the SAS server, that is possible (just not with EG). For example, if you have terminal access to the SAS server via putty or whatever, you can do a batch submit.
Enterprise Guide is quite capable of scheduling jobs, whether or not you have a local SAS installation.
Wendy McHenry covers this well in Four Ways to Schedule SAS Tasks. Way 1 is what you probably are familiar with ('batch'), but Ways 2 through 4 are all possible in server environments.
Way 2 is what I use, which is specifically covered in Chris Hemedinger's post Doing More with SAS Enterprise Guide Automation. In Enterprise Guide since I think EG 4.3, there has been an option in the File menu "Schedule ...", as well as a right-click option on a process flow "Schedule ...". These create VBScript files that can be scheduled using your normal Windows scheduler, and allow you to schedule a process flow or a project to run unattended, even if it needs to connect to a server.
You need to make sure you can connect to that server using the credentials you'll schedule the job to run under, of course, and that any network connections are created when you're not logged in interactively, but other than that it's quite simple to schedule the job. Then, once you've run it, it will save the project with the updated log and results tabs.
If your company uses the full suite of server products, I would definitely recommend seeing if you can get Way 3 to work (using SAS Management Console) - that is likely easier than doing it through EG. That's how SAS would expect you to schedule jobs in that kind of environment (and lets your SAS Administrator have better visibility on when the server will be more/less busy).
I use pc sas 9.4. But the server is on Linux, so instead of running my program in batch on the server I have a little script I run at the top of my program which uses a remote engine to connect. I also assign a libname and run my datasteps which create permanent datasets. However when I do this, my program runs for 6 hours, but when I run the program without a libname, meaning the datasets are generated in my work directory, the same program runs in 10 minutes. No one seems to know why that is, and I was told to just run my code directly on the unix server. I don't like the look of sas on unix, and using unix editors, saving .sas files to run them. I prefer using the sas windows GUI. Why is there such a difference in runtime?
Many thanks in advance.
As you are not using rsubmit; you are actually not working on the server, only your data is stored on the server. You are downloading the data from the server to your PC before performing any calculations. Depending on your network, this will take some time.
Try this:
rsubmit XXX_server_name;
... Your Code ...
endrsubmit;
That way you will be working on the server, not just using data in a library on the server.
I have a prompt that generate a variable across all my project (the SET_ENVIRONMENT macro variable).
I then run my programs on by one in my process flow.
The only problem is that some of them are local (when I want to upload data), and some of them are remote (using sas metadata server).
A solution would be to run my SET_PROMPT program twice, once on my local, once on my SAS Metadata Server.
I was wondering if it was possible to do set both prompts at the same time?
If this works like a SAS/CONNECT session, then what you might do is link your prompt to a program in the local session. Have that program then be responsible for using %SYSRPUT to assign the variable on the metadata server, and have that program be always the first program you execute. That way you don't need two prompts (which is annoying for the user) but get it assigned in two places at once.
How can I use include statement to reference local file when I'm connected to server?
When I run the code I get an error saying that there is no such file on the server.
How do I tell EG to look for file locally?
I have ways to get around that, like telling the code to run on 'local' server and then
I copy results over. Or I just add the code I need as a Code node in EG.
Both of those are not very practical when working with old code that uses include heavily.
In Enterprise Guide, programs (code nodes) have an option to choose the environment. Choose LOCAL for the program that executes the %INCLUDE for the local program. Then you need to move the resulting data set(s) to the remote server via SAS/CONNECT (RSUBMIT) and put them in a permanent location. The subsequent programs can have your remote server chosen as the environment and will be able to act on the data you previously moved up the remote server.
If this seems plausible...I can expand the answer
If you are looking to reference local SAS data sets (sas7bdat files), you can use the Tasks->Data->Upload Data Files to Server task. This will capture the step of copying your data set files to the SAS workspace as part of your process flow.