ftp / sftp with SPSS

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

ftp / sftp with SPSS

drfg2008
Can I access data via ftp (sftp) directly via SPSS ?

Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: ftp / sftp with SPSS

Jon K Peck
Not with built-in capabilities, but the SPSSINC GETURI DATA extension command can do this.  For example,

SPSSINC GETRI DATA URL="ftp://blah blah blah".

The command supports SPSS,  XLS, SAS, and STATA files via the FILETYPE keyword.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        drfg2008 <[hidden email]>
To:        [hidden email],
Date:        08/23/2013 05:36 AM
Subject:        [SPSSX-L] ftp / sftp with SPSS
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Can I access data via ftp (sftp) directly via SPSS ?





-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/ftp-sftp-with-SPSS-tp5721698.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Reply | Threaded
Open this post in threaded view
|

Re: ftp / sftp with SPSS

drfg2008
thanks! Yes, I remember using it once. But what if passwords are needed. I don't remember if this could be handled with SPSSINC .
Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: ftp / sftp with SPSS

Jon K Peck
Usually you can include the password in the url, although I have never tried that with this command.  Try something like
ftp://username:password@server/resource.ext


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        drfg2008 <[hidden email]>
To:        [hidden email],
Date:        08/23/2013 08:43 AM
Subject:        Re: [SPSSX-L] ftp / sftp with SPSS
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




thanks! Yes, I remember using it once. But what if passwords are needed. I
don't remember if this could be handled with SPSSINC .



-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/ftp-sftp-with-SPSS-tp5721698p5721704.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Reply | Threaded
Open this post in threaded view
|

Re: ftp / sftp with SPSS

drfg2008
This post was updated on .
I encountered a little problem:

I get the following error message when running (as an example)

SPSSINC GETURI DATA URI="http://spss-seminar.de/youtube-1.sav".


">Error # 1.  Command name: SPSSINC
>The first word in the line is not recognized as an SPSS Statistics command.
>Execution of this command stops."


Background: I reinstalled on WIN 7 / SPSS20 the extension:

SPSSINC_GETURI_DATA.spe

in: C:\Program Files\IBM\SPSS\Statistics\20\extensions

and run the installation via drop down menu: Utilities -> Extension Bundles -> Install Extension Bundles

No problem there, although during installation no feedback or anything but also no error message


Python is also installed and works.

Is there a problem with WIN 7 similar to that with WIN VISTA?
Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: ftp / sftp with SPSS

Jon K Peck
Assuming that you restarted Statistics after installing this command, that message means that the SPSSINC_GETURI_DATA.xml file was not found in any of the locations that Statistics scans on startup.  The most common cause is that the process did not have permission to write to any of those directories.  Try starting Statistics using Run As Administrator and reinstall the extension.  If that does not work, see the FAQ on the Community website for other solutions.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        drfg2008 <[hidden email]>
To:        [hidden email],
Date:        08/24/2013 02:53 AM
Subject:        Re: [SPSSX-L] ftp / sftp with SPSS
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




I encountered a little problem:

I get the following error message when running (as an example)

SPSSINC GETURI DATA URI="
http://spss-seminar.de/youtube-1.sav".


">Error # 1.  Command name: SPSSINC
>The first word in the line is not recognized as an SPSS Statistics command.
>Execution of this command stops."


Background: I reinstalled on WIN 7 / SPSS20 the extension:

SPSSINC_GETURI_DATA.spe

in: C:\Program Files\IBM\SPSS\Statistics\20\extensions

and run the installation via drop down menu: Utilities -> Extension Bundles
-> Install Extension Bundles

No problem there, although during installation no feedback or anything but
also no error message


Python is also installed and works.



-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/ftp-sftp-with-SPSS-tp5721698p5721717.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Reply | Threaded
Open this post in threaded view
|

Re: ftp / sftp with SPSS

drfg2008
That's it: Run As Admin.

It works now. Thanks!

(Since the account is an admin account, I did not know that to run SPSS as admin it is necessary to start SPSS separately under extra RAA )
Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: ftp / sftp with SPSS

drfg2008
In reply to this post by Jon K Peck
We just learned that the data is CSV. Any way to read in csv files from remote server via sftp  with SPSS?
Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: ftp / sftp with SPSS

Jon K Peck
That could, in principle be done, but the specifications are completely different, so it would not fit into the structure of the current command.  Maybe I could add something to just download the file, and then you could read it with the usual GET DATA command.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        drfg2008 <[hidden email]>
To:        [hidden email],
Date:        08/26/2013 03:17 AM
Subject:        Re: [SPSSX-L] ftp / sftp with SPSS
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




We just learned that the data is CSV. Any way to read in csv files from
remote server via sftp  with SPSS?



-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/ftp-sftp-with-SPSS-tp5721698p5721725.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Reply | Threaded
Open this post in threaded view
|

Re: ftp / sftp with SPSS

drfg2008
It would be really great to have a tool like that!
We need it for automated running of scripts.
Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: ftp / sftp with SPSS

Albert-Jan Roskam
assuming there is a working internet connection, the remote file exists, rights for the download location, etc.:
import urllib
url = "http://www-01.ibm.com/software/analytics/spss/products/statistics/images/icon-statistics-60x60.jpg"
filename = 'd:/temp/spss.jpg'
download = urllib.urlretrieve(url, filename)

Regards,
Albert-Jan


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


----- Original Message -----

> From: drfg2008 <[hidden email]>
> To: [hidden email]
> Cc:
> Sent: Monday, August 26, 2013 3:30 PM
> Subject: Re: [SPSSX-L] ftp / sftp with SPSS
>
> It would be really great to have a tool like that!
> We need it for automated running of scripts.
>
>
>
> -----
> Dr. Frank Gaeth
> FU-Berlin
>
> --
> View this message in context:
> http://spssx-discussion.1045642.n5.nabble.com/ftp-sftp-with-SPSS-tp5721698p5721730.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: ftp / sftp with SPSS

drfg2008
@ Albert:

I guess, you use the Python plugin from SPSS Syntax.

I tried without success so far.

I.e. How would you download this file?

http://datest.de/mm/test/TestFile1.csv


Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: ftp / sftp with SPSS

Albert-Jan Roskam
Hi,

This works for me. Of course you don't necessarily need tempfile.gettempdir. The downloaded file is <whatever your tempdir is>/TestFile1.csv.

BEGIN PROGRAM.
import urllib, tempfile, os
url = "http://datest.de/mm/test/TestFile1.csv"
download = urllib.urlretrieve(url, os.path.join(tempfile.gettempdir(), os.path.basename(url)))
print "downloaded to '%s'" % download[0]

END PROGRAM.


Regards,
Albert-Jan


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


----- Original Message -----

> From: drfg2008 <[hidden email]>
> To: [hidden email]
> Cc:
> Sent: Tuesday, August 27, 2013 12:25 PM
> Subject: Re: [SPSSX-L] ftp / sftp with SPSS
>
> @ Albert:
>
> I guess, you use the Python plugin from SPSS Syntax.
>
> I tried without success so far.
>
> I.e. How would you download this file?
>
> http://datest.de/mm/test/TestFile1.csv
>
>
>
>
>
>
> -----
> Dr. Frank Gaeth
> FU-Berlin
>
> --
> View this message in context:
> http://spssx-discussion.1045642.n5.nabble.com/ftp-sftp-with-SPSS-tp5721698p5721741.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: ftp / sftp with SPSS

drfg2008
yep, that works
Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: ftp / sftp with SPSS

Jon K Peck
In reply to this post by drfg2008
spssinc geturi data uri="http://datest.de/mm/test/TestFile1.csv" filetype=other
save="c:/temp".

TestFile1.csv

Var1,Var2

1,10
2,20
3,30
4,40
5,50
6,60
7,70
8,80
9,90
10,100
Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        drfg2008 <[hidden email]>
To:        [hidden email],
Date:        08/27/2013 04:26 AM
Subject:        Re: [SPSSX-L] ftp / sftp with SPSS
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




@ Albert:

I guess, you use the Python plugin from SPSS Syntax.

I tried without success so far.

I.e. How would you download this file?

http://datest.de/mm/test/TestFile1.csv






-----
Dr. Frank Gaeth
FU-Berlin

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/ftp-sftp-with-SPSS-tp5721698p5721741.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD