I'm struggling to find a solution to this problem.
The import/export wizard works fine from SAS for pathing to static local and shared drive file locations.
I get stuck trying to use PROC EXPORT so save multiple datasets to different sheets in an Excel workbook for retention policies.
I thought I found a solution that would be great. Referencing a LIBNAME to a local file.
When I run:
""LIBNAME x xlsx 'C:\Users\xxxx\Desktop\EXISITING_CONSOL.xlsx';""
I get confirmation it worked, but when I reference it or try to view it in the Servers navigation window it errors out.
NOTE: Libref X was successfully assigned as follows:
Engine: XLSX
Physical Name: C:\Users\xxxx\Desktop\EXISITING_CONSOL.xlsx
Current version: 9.04.01M3P062415
Operating System: LIN X64
---SAS/ACCESS Interface to PC Files
I would like to use this library method but I'm indifferent to a solution as long as I can save the datasets to a folder path through my PC that I can F3.
I appreciate any direction!
The issue you have here is that SAS can't actually see your c:\users\... folder, unless you have a share set up (and since the SAS Server is on Linux, it would have to have a different structure anyway). The "Import wizard" actually imports it locally (using some .Net code in Enterprise Guide) and then uploads the data to the SAS server.
The normal way this is handled is for you to use a network share that both SAS and your local PC can see - often something like \yourcompany.com\sharename\foldername\ or similar.
If you don't have something like this, then you can use the "Copy Files" task in Enterprise Guide to copy files down locally that are on the server. See this blog post about it.
Related
I know that recent versions of EG can copy files between a SAS server and the local Windows filesystem. But is there any way of getting EG to delete a file as a step in a process flow?
Assuming you're running EG connected to a server that does not have access to your local PC, I don't believe you can without using .NET or something inside EG. You cannot do something like run an X command or similar, because SAS is not on your local machine and can't access it.
It should be possible however to script (using .NET) an extension to EG to do something like this, though (the same way the copy files extension was originally written). But it wouldn't be a SAS process.
Note: The original task was described in a blog post by Chris Hemedinger; that post did not however describe how to actually write such an extension beyond detailing that it uses SAS Workspace APIs. You might look into that first.
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!!
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.
I have created a SAS folder say "/Public Development/Area Name/Project Name" under "Folders" tab of SAS Management console.
In SAS EG this folder shows under "SAS Folder" option. I'm able to save EGP project and stored processes in this folder but not SAS code, log etc.
I believe its just a folder at meta data level and only items registered at meta data can be saved here.
So what approach should I take to organize my other project items like code, jobs, macros, Reports...?
The Enterprise Guide model includes storing your code as part of your EGP project. You put code modules in process flows, and log and output are stored alongside them (in a somewhat similar fashion to if you had run them in batch mode - log, output, and program are grouped as one entity effectively).
Your organization may have specific rules for how code/etc. is stored, such as storing it in a SVN repository or similar, so you should check with your manager or site SAS admin to get a more complete answer that is specific to your site.
I tend to keep metadata folders for storing metadata objects (stored processes, DI jobs, etc), and I use OS file system for storing code (.sas files), .log files, etc and .egp projects. Generally I don't store code as part of the EG project, instead the project just links to code that is sitting in the OS file system. So basically, I store my code, logs, macros, format catalogs, output reports, etc etc the same way as I did when I was using PC SAS.
I am running SAS EG which is installed in Windows but have access to GRID in AIX. Now I want to drop some of the files generated in a program (mostly csv) to a windows location.
My first question, is it possible without using fancy X or call system (guessing) routine with just one libname or filename.
Second question is will it be possible to drop generated files from EG session in the windows directory.
If you have SAS/CONNECT licensed, and are able to run a local SAS session as well as the connection to UNIX, you can use PROC UPLOAD or DOWNLOAD, or even better, you can define a libname like so:
libname ulib server=unix slibref=work;
server=unix defines which remote session you are accessing (you may have multiple simultaneously) and slibref=work defines which server-side libname you are accessing. Change both values as needed. This requires having an open connection to the server (via SAS/CONNECT), and would be executed in your local session.
If you do NOT have SAS/CONNECT licensed, and/or cannot start a local session on your desktop, you have a few options.
First off, if the UNIX server can mount the windows location as a drive, then you can simply write to it as if it were on the UNIX machine. This is likely if it is on a shared drive on your NAS or similar; however, if by 'windows location' you mean 'on my desktop machine', it's unlikely.
Second, you may be able to use an EG add-on that allows you to do this. If you're able to install it, it's a simple point and click interface. It is NOT scriptable in SAS (it may be scriptable via automation, I'm not sure). Chris Hemedinger made it available in his blog (currelt(http://blogs.sas.com/content/sasdummy/2012/12/06/copy-files-in-sas-eg/); it is called "Copy Files" if that link breaks and you need to search for it. The blog post has the add-on and instructions for installing it.