|
SAS has the ability to connect to another system and
remotely access files. This is particularly useful for accessing files
residing on your local PC from within a SAS program running on the Stats
server.
The first step is to install an FTP server on your
local system. The Exceed package available from Central IT contains a FTP
server and is available for download from general.asu.edu. For
instructions on how to download Exceed, go to:
http://www.asu.edu/it/fyi/dst/unix/xwin/exceed.html
Once Exceed is installed, go to the Control Panel
and click the red devil icon named "Hummingbird Inetd". In the
window that pops up, click on "Ftpd" so that it is highlighted
and then click the Enable button.
To avoid security risks, the Ftpd service should
only be enabled when you are using it and then immediately disabled when
your are finished. Also, firewalls may block the service.
At this point, you are able to connect to your PC
using SAS's FTP service. Below is a sample Unix SAS program demonstrating
on how this is done:
filename transin ftp 'c:\mydat.pc' user='your_username'
host='149.169.1.1' pass='you_password';
libname transout v8 '~/';
proc cimport data=transout.fullann infile=transin;
run;
The purpose of this SAS program is to retrieve a SAS
transport file called "mydat.pc" from a remote system and
extract it into a SAS dataset on the local Unix system. The key to
accessing files remotely is in the filename statement. "Transin"
is the name of the filehandle and can be set to any valid SAS name. The
"ftp" option instructs SAS to access the file via FTP from a
remote system. The path "c:\mydat.pc" is the path on the REMOTE
system where the target file resides. You will need to change the
italicized "your_username" and "your_password"
to the username and password that was used to log into the remote system.
The "host=" option gives the IP address of the remote system to
be connected to.
If you do not know the IP address of your PC, you
can find it under Windows 2000 but running Command Prompt from the
Programs->Accessories folder and the typing in "ipconfig"
followed by the return key.
This method can be used on transport files and plain
text files. However, the SAS dataset format varies by platform (ie. a PC
SAS dataset will not work with Unix SAS). Therefore, it is not possible to
directly use a SAS dataset residing on a PC from within a Unix SAS
program. Instead, the PC SAS dataset should first be converted to a
transport file, then read into Unix SAS. For instructions on how to do
this, go to:
http://wpcarey.asu.edu/it/research/software/xport.cfm
|