BookmarkSubscribeRSS Feed
sas_student1
Quartz | Level 8

Hello,

 

I am not sure if this question if for this board however I hope someone can assist me.

 

My question is how to connect to UNIX server using PC SAS.

I have data that is submitted in a UNIX server. I would like to be able to connect to this server via my PC SAS and get the data out.

Currently I use Putty and WinSCP to FTP data over.

 

I tried using the following commands (note items in { } are purposely incorrect information to protect confideintality)

 

OPTIONS REMOTE={remote host name} COMAMID=TCP;

FILENAME RLINK "{full directory path to scr file }\tcpunix.scr";

SIGNON {remote host name};

 

I know I am missing a few command step. I need to add a username and password as well, as I enter that when I access UNIX.

 

Can anyone assist in fixing the command above. Or suggest another way of connecting to UNIX server to extract data.

 

Thank you in Advance!

 

 

11 REPLIES 11
SASKiwi
PROC Star

First of all you need to confirm SAS/CONNECT is installed and licensed on both your PC and SAS server.

 

Next, I suggest you ask your SAS admin if the SAS/CONNECT spawner is running or not. If it is then you don't need to use a script file at all and just use:

 

signon  hostname userid=abc password='xyz';
rogerjdeangelis
Barite | Level 11

Somewhat dated but I attached instruction on installing SAS connect(circa 2000 windows to unix), I hope SAS has not removed functionality needed to set up the environment. It used to work.

 

I find SAS connect to be the best enviroment for SAS development, especially if you use the old text editor(not EE, EG or SAS studio). You get both the power of full SAS on your power workstation but a direct bi-directional persistent connection to a full SAS running on the sever(no VM or EG on server).

 

I have about 60 editor tasks, 20 or so on my 5 button mouse, all available command line or function keys. These tasks like list the lat 40 obs of last created dataset, have both local or server actions lst for loacal dataset and lstr if dataset remote.

DanielSantos
Barite | Level 11

Hi.

 

The remote host name is two parts, <machine name> <service port>

 

You can provide it in several flavors

 

<machine name>.<service port alias>

<machine name and server port alias>

<machine name> <server port>

 

The first and the second depends on aliases defined in the host file of your windows desktop (I'm assuming you are trying to connect from a windows workstation). So, if your not sure what it's this about, use the third form.

 

signoff unixsrv; * close any previous conection;
%let unixsrv= unixservername 7551; * 7551 is the common SAS/CONNECT port, not necessarly yours;
options comamid=tcp;
signon unixsrv user=_prompt_; * will prompt for user and password;

 

 

Not sure if you need some aditional login steps with a tcpscript, try the above first.

 

Of course, as it was pointed before, you will need SAS/CONNECT licensed on both machines.

 

submit (on both machines):

 

proc setinit; run;

 

to check this.

 

Hope it Helps.

 

Daniel Santos @ www.cgd.pt

sas_student1
Quartz | Level 8

I checked and unfortunatley in SAS UNIX I dont have SAS/CONNECT. However, what if I just want to connect to unix to get a file over to windows? Kind of like an FTP over, then do I still need to have both systems have SAS/CONNECT? I am not wanting to run SAS command in UNIX via PC SAS.

 

Another contributer suggested this link : https://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p0v0ijxl1k6d4b...

and example 2 in this link is I belive what I need, but it is still not clear.

 

Any help and suggestions would be great!

 

Thank you

sas_student1
Quartz | Level 8

Hello thank you for your reply and suggestion:

So I tried one of the examples in the link you provided (https://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p0v0ijxl1k6d4b...) Specifically example 2 as that is exactly what I would like to do but I am not getting the syntax completely correct.

 

Example below of my syntax and question:

 

filename myfile ftp '[name of SAS dataset in UNIX here]' cd='[Directory location of SAS dataset]

user='[username to connect to UNIX' host='UNIX host address here'

recfm=v prompt;

 

I seem to get the above command correct (at least there are no errors, but nothing really happens).

Now I am a bit confused as to the next step of the example (I pasted the example below).

I dont understand for a SAS permananet dataset how the next step works (actually it doesnt, right?)

data mydata / view=mydata;   /* Create a view */
   infile myfile;
   input x $10. y 4.;
run;
proc print data=mydata;     /* Print the data */
run;

 

Also in other posts they state that I have to have SAS/Connect in both the windows environemtn and UNIX environment for the CONNECT to work. I worked and I dont have SAS/CONNECT in the UNIX environment. However, if I want to just get a file from UNIX and bring it over to Windows (be the file be an excel, txt or sas permanent dataset) do I still need to have SAS/CONNECT in both environments? I would think not, especially if the above code works, right?

 

A little bit of my background: I am a self learner of UNIX, so some of the language I wont get right away. Examples help me greatly!

 

Thank you all in advance! I appreciate this forum and all those who contribute to it!

 

 

 

 

Shmuel
Garnet | Level 18

Your main question is:   "How to connect to UNIX server using PC SAS ?"

and you noticed "Currently I use Putty and WinSCP to FTP data over."

 

Does it mean that you have installed SAS on a PC with windows OS ?

What kind of data do you have on your UNIX computer ? Is it a UNIX SAS server ?

 

You said you are a self lerner.

Does it mean you installed SAS University Edidion on your PC ? On the UNIX computer ?

Do you have SAS installed on both - PC and UNIX ?

 

Using FILENAME xxx FTP  enables read and write a "flat" file like .txt , .csv  files from/on remote host.

Using FILENAME xxx (excel or xml) enable read/create such files from/on local host.

The words FTP EXCEL XML etc. in a filename, comming after the fileref, are called engines.

I have never met a filename with combination of engines. I'm quite sure it is impossible.

 

If you have SAS server and sas datasets on remote host, than you need SAS CONNECT in order

use them with local sas.

 

I made a search by google  for "sas support remote host data" and got a lot of links.

I think that next link will give you a betterr information on SAS CONNECT:

https://support.sas.com/training/tutorial/el/libspcnd_rh.pdf

but if you use SAS UE (University Edition) then you don't have SAS CONNECT installed.

 

 

 

sas_student1
Quartz | Level 8

Thank you for your reply,

I will look at the links

 

to respond to your questions in purple:

 

Does it mean that you have installed SAS on a PC with windows OS ? --> I have SAS installed in both PC with windows and SAS installed in UNIX.

 

What kind of data do you have on your UNIX computer ? --> I have different data in UNIX computer, from .dat files to excel files (that were FTPd from windows) and sas permanent data sets. Is it a UNIX SAS server ? --> I dont belive it is a UNIX SAS server but will have to check again.

 

You said you are a self lerner. --> I meant self learner in codes and commnads.

Softwares were installed on my compter for work.

Does it mean you installed SAS University Edidion on your PC ? On the UNIX computer ?

Do you have SAS installed on both - PC and UNIX ? -> SAS is installed in both PC and UNIX.

 

 Thank you again and I will reserach the links.

Patrick
Opal | Level 21

If you're able to download files via Putty then you have a good chance that it's also possible directly out of SAS via a Filename statement using the sFTP engine. Documentation here:

https://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p0xln1fiwsr340...

 

SAS/Connect allows communication between two SAS servers (your remote server and your local "PC SAS" server). Using SAS connect when exchanging SAS files has the advantage that SAS will convert the SAS files to the native representation of the host you're using.

 

When downloading SAS files from a SAS Unix to a SAS Windows environment via sFTP then you get files which are no more in the native representation of the host system and there are some limitations to it.

http://support.sas.com/documentation/cdl/en/lrcon/69852/HTML/default/viewer.htm#p1kll044bewka4n12ah0...

http://support.sas.com/documentation/cdl/en/movefile/69975/HTML/default/viewer.htm#n061eapioxlebin10...

http://support.sas.com/documentation/cdl/en/lrcon/69852/HTML/default/viewer.htm#n0oj2nagtyy32yn17pj0...

 

sas_student1
Quartz | Level 8

Thank you again for your reply.

 

Looks like I have a lot to read up on.

I'll look at the links to see if I can get some clues on how to do this.

If this works this will help with my work greatly!

 

Thank you

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 11 replies
  • 7493 views
  • 0 likes
  • 6 in conversation