SPSS datasets re: COVID 19

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

SPSS datasets re: COVID 19

Art Kendall
Has SPSS or anybody else put data related to Covid 19 into SPSS datasets?



-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: SPSS datasets re: COVID 19

John F Hall
Not sure, but try the Understanding Society team at Essex
https://www.understandingsociety.ac.uk/research/themes/covid-19 
the BSAS team at Natcen
http://natcen.ac.uk/our-research/research/british-social-attitudes/
 or the UK Govt  Office for National Statistics
https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/cond
itionsanddiseases
Stay safe

John F Hall MA (Cantab) Dip Ed (Dunelm)
IBM-SPSS Academic Author 9900074

Email: [hidden email]
Website: Journeys in Survey Research
Course: Survey Analysis Workshop (SPSS)
-----Original Message-----
From: SPSSX(r) Discussion <[hidden email]> On Behalf Of Art
Kendall
Sent: 27 April 2020 16:56
To: [hidden email]
Subject: SPSS datasets re: COVID 19

Has SPSS or anybody else put data related to Covid 19 into SPSS datasets?



-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.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: SPSS datasets re: COVID 19

Bruce Weaver
Administrator
In reply to this post by Art Kendall
You can download CSV or Excel formatted data from the page linked below.  (It
appears to be updated daily.)  

   https://ourworldindata.org/coronavirus

Either format can be imported into SPSS easily enough.  Here is code for
importing the CSV file:  
 

* Import "Our World in Data" COVID data set from CSV file.
* Download the CSV file from:
    https://ourworldindata.org/coronavirus
* Then modify the following FILE HANDLE commands
* to indicate where you saved it on your hard disk
* and where you want to save the .SAV file.

FILE HANDLE CSVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.csv".
FILE HANDLE SAVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.sav".

* Now import the data.
NEW FILE.
DATASET CLOSE ALL.

PRESERVE.
SET DECIMAL DOT.

GET DATA  /TYPE=TXT
  /FILE= "CSVfile"
  /ENCODING='UTF8'
  /DELIMITERS=","
  /QUALIFIER='"'
  /ARRANGEMENT=DELIMITED
  /FIRSTCASE=2
  /DATATYPEMIN PERCENTAGE=95.0
  /VARIABLES=
  iso_code AUTO
  location AUTO
  date sdate10
  total_cases AUTO
  new_cases AUTO
  total_deaths AUTO
  new_deaths AUTO
  total_cases_per_million AUTO
  new_cases_per_million AUTO
  total_deaths_per_million AUTO
  new_deaths_per_million AUTO
  total_tests AUTO
  new_tests AUTO
  total_tests_per_thousand AUTO
  new_tests_per_thousand AUTO
  tests_units AUTO
  /MAP.
RESTORE.
CACHE.

STRING ImportDate (A11).
COMPUTE ImportDate = $DATE11.
ALTER TYPE ImportDate (DATE11).
DESCRIPTIVES date ImportDate /STATISTICS=MIN MAX.
* Compare MAX values of date and ImportDate to
* confirm that the data are up-to-date.  

SAVE OUTFILE = "SAVfile".



Art Kendall wrote

> Has SPSS or anybody else put data related to Covid 19 into SPSS datasets?
>
>
>
> -----
> Art Kendall
> Social Research Consultants
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
Reply | Threaded
Open this post in threaded view
|

Re: SPSS datasets re: COVID 19

Bruce Weaver
Administrator
I hoped to automate that code a bit more by including SPSSINC GETURI DATA to
remove the step of manually downloading the CSV file.  Here's what I tried:

SPSSINC GETURI DATA
URI="https://covid.ourworldindata.org/data/owid-covid-data.csv"
FILETYPE=OTHER SAVE="C:\bw\Data\COVID19".

Unfortunately, the file is not downloaded, and I see this warning (despite
the fact that I can download the file manually using that same URI):  

Warnings
The specified uri is not valid:
https://covid.ourworldindata.org/data/owid-covid-data.csv

Any idea what's going on here, Jon (or anyone else)?  



Bruce Weaver wrote

> You can download CSV or Excel formatted data from the page linked below.
> (It
> appears to be updated daily.)  
>
>    https://ourworldindata.org/coronavirus
>
> Either format can be imported into SPSS easily enough.  Here is code for
> importing the CSV file:  
>  
>
> * Import "Our World in Data" COVID data set from CSV file.
> * Download the CSV file from:
>     https://ourworldindata.org/coronavirus
> * Then modify the following FILE HANDLE commands
> * to indicate where you saved it on your hard disk
> * and where you want to save the .SAV file.
>
> FILE HANDLE CSVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.csv".
> FILE HANDLE SAVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.sav".
>
> --- snip the rest ---





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
Reply | Threaded
Open this post in threaded view
|

Re: SPSS datasets re: COVID 19

Jon Peck
It worked for me.  This is what I see in the log

SPSSINC GETURI DATA
URI="https://covid.ourworldindata.org/data/owid-covid-data.csv"
FILETYPE=OTHER SAVE="C:\bw\Data\COVID19".
The requested file, owid-covid-data.csv, has been saved in C:\bw\Data\COVID19.

Are you able to access that URL directly in a browser?

On Fri, May 8, 2020 at 8:35 AM Bruce Weaver <[hidden email]> wrote:
I hoped to automate that code a bit more by including SPSSINC GETURI DATA to
remove the step of manually downloading the CSV file.  Here's what I tried:

SPSSINC GETURI DATA
URI="https://covid.ourworldindata.org/data/owid-covid-data.csv"
FILETYPE=OTHER SAVE="C:\bw\Data\COVID19".

Unfortunately, the file is not downloaded, and I see this warning (despite
the fact that I can download the file manually using that same URI): 

Warnings
The specified uri is not valid:
https://covid.ourworldindata.org/data/owid-covid-data.csv

Any idea what's going on here, Jon (or anyone else)? 



Bruce Weaver wrote
> You can download CSV or Excel formatted data from the page linked below.
> (It
> appears to be updated daily.) 
>
>    https://ourworldindata.org/coronavirus
>
> Either format can be imported into SPSS easily enough.  Here is code for
> importing the CSV file: 

>
> * Import "Our World in Data" COVID data set from CSV file.
> * Download the CSV file from:
>     https://ourworldindata.org/coronavirus
> * Then modify the following FILE HANDLE commands
> * to indicate where you saved it on your hard disk
> * and where you want to save the .SAV file.
>
> FILE HANDLE CSVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.csv".
> FILE HANDLE SAVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.sav".
>
> --- snip the rest ---





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.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


--
Jon K Peck
[hidden email]

===================== 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: SPSS datasets re: COVID 19

Mario Giesel-2
Jon,

it didn't work for me either, although I can get it manually in a browser:

Warnings
The specified uri is not valid: https://covid.ourworldindata.org/data/owid-covid-data.csv

Is it a Windows problem?





Am Freitag, 8. Mai 2020, 16:43:59 MESZ hat Jon Peck <[hidden email]> Folgendes geschrieben:


It worked for me.  This is what I see in the log

SPSSINC GETURI DATA
URI="https://covid.ourworldindata.org/data/owid-covid-data.csv"
FILETYPE=OTHER SAVE="C:\bw\Data\COVID19".
The requested file, owid-covid-data.csv, has been saved in C:\bw\Data\COVID19.

Are you able to access that URL directly in a browser?

On Fri, May 8, 2020 at 8:35 AM Bruce Weaver <[hidden email]> wrote:
I hoped to automate that code a bit more by including SPSSINC GETURI DATA to
remove the step of manually downloading the CSV file.  Here's what I tried:

SPSSINC GETURI DATA
URI="https://covid.ourworldindata.org/data/owid-covid-data.csv"
FILETYPE=OTHER SAVE="C:\bw\Data\COVID19".

Unfortunately, the file is not downloaded, and I see this warning (despite
the fact that I can download the file manually using that same URI): 

Warnings
The specified uri is not valid:
https://covid.ourworldindata.org/data/owid-covid-data.csv

Any idea what's going on here, Jon (or anyone else)? 



Bruce Weaver wrote
> You can download CSV or Excel formatted data from the page linked below.
> (It
> appears to be updated daily.) 
>
>    https://ourworldindata.org/coronavirus
>
> Either format can be imported into SPSS easily enough.  Here is code for
> importing the CSV file: 

>
> * Import "Our World in Data" COVID data set from CSV file.
> * Download the CSV file from:
>     https://ourworldindata.org/coronavirus
> * Then modify the following FILE HANDLE commands
> * to indicate where you saved it on your hard disk
> * and where you want to save the .SAV file.
>
> FILE HANDLE CSVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.csv".
> FILE HANDLE SAVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.sav".
>
> --- snip the rest ---





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.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


--
Jon K Peck
[hidden email]

===================== 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: SPSS datasets re: COVID 19

Jon Peck
I can't see anything odd about that url's properties, although it is conceivable that a proxy server is interfering.

Can you try this using http instead of  https?  (Both protocols work for me).

On Fri, May 8, 2020 at 9:05 AM [hidden email] <[hidden email]> wrote:
Jon,

it didn't work for me either, although I can get it manually in a browser:

Warnings

Is it a Windows problem?





Am Freitag, 8. Mai 2020, 16:43:59 MESZ hat Jon Peck <[hidden email]> Folgendes geschrieben:


It worked for me.  This is what I see in the log

SPSSINC GETURI DATA
URI="https://covid.ourworldindata.org/data/owid-covid-data.csv"
FILETYPE=OTHER SAVE="C:\bw\Data\COVID19".
The requested file, owid-covid-data.csv, has been saved in C:\bw\Data\COVID19.

Are you able to access that URL directly in a browser?

On Fri, May 8, 2020 at 8:35 AM Bruce Weaver <[hidden email]> wrote:
I hoped to automate that code a bit more by including SPSSINC GETURI DATA to
remove the step of manually downloading the CSV file.  Here's what I tried:

SPSSINC GETURI DATA
URI="https://covid.ourworldindata.org/data/owid-covid-data.csv"
FILETYPE=OTHER SAVE="C:\bw\Data\COVID19".

Unfortunately, the file is not downloaded, and I see this warning (despite
the fact that I can download the file manually using that same URI): 

Warnings
The specified uri is not valid:
https://covid.ourworldindata.org/data/owid-covid-data.csv

Any idea what's going on here, Jon (or anyone else)? 



Bruce Weaver wrote
> You can download CSV or Excel formatted data from the page linked below.
> (It
> appears to be updated daily.) 
>
>    https://ourworldindata.org/coronavirus
>
> Either format can be imported into SPSS easily enough.  Here is code for
> importing the CSV file: 

>
> * Import "Our World in Data" COVID data set from CSV file.
> * Download the CSV file from:
>     https://ourworldindata.org/coronavirus
> * Then modify the following FILE HANDLE commands
> * to indicate where you saved it on your hard disk
> * and where you want to save the .SAV file.
>
> FILE HANDLE CSVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.csv".
> FILE HANDLE SAVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.sav".
>
> --- snip the rest ---





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.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


--
Jon K Peck
[hidden email]

===================== 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


--
Jon K Peck
[hidden email]

===================== 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: SPSS datasets re: COVID 19

Bruce Weaver
Administrator
I just tried again with http in place of https, and got the same warning.  

Jon, when you say both protocols work for you, do you mean the work using
SPSSINC GETURI DATA?  Or did you mean when downloading the file manually?  

Cheers,
Bruce


Jon Peck wrote
> I can't see anything odd about that url's properties, although it is
> conceivable that a proxy server is interfering.
>
> Can you try this using http instead of  https?  (Both protocols work for
> me).
>
> On Fri, May 8, 2020 at 9:05 AM

> spss.giesel@

>  &lt;

> spss.giesel@

> &gt;
> wrote:
>
>> Jon,
>>
>> it didn't work for me either, although I can get it manually in a
>> browser:
>>
>> Warnings
>> The specified uri is not valid:
>> https://covid.ourworldindata.org/data/owid-covid-data.csv
>>
>> Is it a Windows problem?
>>
>>
>>
>>
>>
>> Am Freitag, 8. Mai 2020, 16:43:59 MESZ hat Jon Peck &lt;

> jkpeck@

> &gt;
>> Folgendes geschrieben:
>>
>>
>> It worked for me.  This is what I see in the log
>>
>> SPSSINC GETURI DATA
>> URI="https://covid.ourworldindata.org/data/owid-covid-data.csv"
>> FILETYPE=OTHER SAVE="C:\bw\Data\COVID19".
>> The requested file, owid-covid-data.csv, has been saved in
>> C:\bw\Data\COVID19.
>>
>> Are you able to access that URL directly in a browser?
>>
>> On Fri, May 8, 2020 at 8:35 AM Bruce Weaver &lt;

> bruce.weaver@

> &gt;
>> wrote:
>>
>> I hoped to automate that code a bit more by including SPSSINC GETURI DATA
>> to
>> remove the step of manually downloading the CSV file.  Here's what I
>> tried:
>>
>> SPSSINC GETURI DATA
>> URI="https://covid.ourworldindata.org/data/owid-covid-data.csv"
>> FILETYPE=OTHER SAVE="C:\bw\Data\COVID19".
>>
>> Unfortunately, the file is not downloaded, and I see this warning
>> (despite
>> the fact that I can download the file manually using that same URI):
>>
>> Warnings
>> The specified uri is not valid:
>> https://covid.ourworldindata.org/data/owid-covid-data.csv
>>
>> Any idea what's going on here, Jon (or anyone else)?
>>
>>
>>
>> Bruce Weaver wrote
>> > You can download CSV or Excel formatted data from the page linked
>> below.
>> > (It
>> > appears to be updated daily.)
>> >
>> >    https://ourworldindata.org/coronavirus
>> >
>> > Either format can be imported into SPSS easily enough.  Here is code
>> for
>> > importing the CSV file:
>> >
>> >
>> > * Import "Our World in Data" COVID data set from CSV file.
>> > * Download the CSV file from:
>> >     https://ourworldindata.org/coronavirus
>> > * Then modify the following FILE HANDLE commands
>> > * to indicate where you saved it on your hard disk
>> > * and where you want to save the .SAV file.
>> >
>> > FILE HANDLE CSVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.csv".
>> > FILE HANDLE SAVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.sav".
>> >
>> > --- snip the rest ---
>>
>>
>>
>>
>>
>> -----
>> --
>> Bruce Weaver
>>

> bweaver@

>> http://sites.google.com/a/lakeheadu.ca/bweaver/
>>
>> "When all else fails, RTFM."
>>
>> NOTE: My Hotmail account is not monitored regularly.
>> To send me an e-mail, please use the address shown above.
>>
>> --
>> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>>

> LISTSERV@.UGA

>  (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
>>
>>
>>
>> --
>> Jon K Peck
>>

> jkpeck@

>>
>> ===================== To manage your subscription to SPSSX-L, send a
>> message to

> LISTSERV@.UGA

>  (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
>>
>
>
> --
> Jon K Peck

> jkpeck@

>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
Reply | Threaded
Open this post in threaded view
|

Re: SPSS datasets re: COVID 19

Jon Peck
Both work with SPSSINC GETURI DATA.  The Python function I used in the extension has some special cases that it might not handle such as certain proxy server situations and maybe some redirection, but I didn’t see that.  I will send you a test program that you can run to see if there is a more precise diagnostic available.

On Fri, May 8, 2020 at 11:43 AM Bruce Weaver <[hidden email]> wrote:
I just tried again with http in place of https, and got the same warning. 

Jon, when you say both protocols work for you, do you mean the work using
SPSSINC GETURI DATA?  Or did you mean when downloading the file manually? 

Cheers,
Bruce


Jon Peck wrote
> I can't see anything odd about that url's properties, although it is
> conceivable that a proxy server is interfering.
>
> Can you try this using http instead of  https?  (Both protocols work for
> me).
>
> On Fri, May 8, 2020 at 9:05 AM

> spss.giesel@

>  &lt;

> spss.giesel@

> &gt;
> wrote:
>
>> Jon,
>>
>> it didn't work for me either, although I can get it manually in a
>> browser:
>>
>> Warnings
>> The specified uri is not valid:
>> https://covid.ourworldindata.org/data/owid-covid-data.csv
>>
>> Is it a Windows problem?
>>
>>
>>
>>
>>
>> Am Freitag, 8. Mai 2020, 16:43:59 MESZ hat Jon Peck &lt;

> jkpeck@

> &gt;
>> Folgendes geschrieben:
>>
>>
>> It worked for me.  This is what I see in the log
>>
>> SPSSINC GETURI DATA
>> URI="https://covid.ourworldindata.org/data/owid-covid-data.csv"
>> FILETYPE=OTHER SAVE="C:\bw\Data\COVID19".
>> The requested file, owid-covid-data.csv, has been saved in
>> C:\bw\Data\COVID19.
>>
>> Are you able to access that URL directly in a browser?
>>
>> On Fri, May 8, 2020 at 8:35 AM Bruce Weaver &lt;

> bruce.weaver@

> &gt;
>> wrote:
>>
>> I hoped to automate that code a bit more by including SPSSINC GETURI DATA
>> to
>> remove the step of manually downloading the CSV file.  Here's what I
>> tried:
>>
>> SPSSINC GETURI DATA
>> URI="https://covid.ourworldindata.org/data/owid-covid-data.csv"
>> FILETYPE=OTHER SAVE="C:\bw\Data\COVID19".
>>
>> Unfortunately, the file is not downloaded, and I see this warning
>> (despite
>> the fact that I can download the file manually using that same URI):
>>
>> Warnings
>> The specified uri is not valid:
>> https://covid.ourworldindata.org/data/owid-covid-data.csv
>>
>> Any idea what's going on here, Jon (or anyone else)?
>>
>>
>>
>> Bruce Weaver wrote
>> > You can download CSV or Excel formatted data from the page linked
>> below.
>> > (It
>> > appears to be updated daily.)
>> >
>> >    https://ourworldindata.org/coronavirus
>> >
>> > Either format can be imported into SPSS easily enough.  Here is code
>> for
>> > importing the CSV file:
>> >
>> >
>> > * Import "Our World in Data" COVID data set from CSV file.
>> > * Download the CSV file from:
>> >     https://ourworldindata.org/coronavirus
>> > * Then modify the following FILE HANDLE commands
>> > * to indicate where you saved it on your hard disk
>> > * and where you want to save the .SAV file.
>> >
>> > FILE HANDLE CSVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.csv".
>> > FILE HANDLE SAVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.sav".
>> >
>> > --- snip the rest ---
>>
>>
>>
>>
>>
>> -----
>> --
>> Bruce Weaver
>>

> bweaver@

>> http://sites.google.com/a/lakeheadu.ca/bweaver/
>>
>> "When all else fails, RTFM."
>>
>> NOTE: My Hotmail account is not monitored regularly.
>> To send me an e-mail, please use the address shown above.
>>
>> --
>> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>>

> LISTSERV@.UGA

>  (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
>>
>>
>>
>> --
>> Jon K Peck
>>

> jkpeck@

>>
>> ===================== To manage your subscription to SPSSX-L, send a
>> message to

> LISTSERV@.UGA

>  (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
>>
>
>
> --
> Jon K Peck

> jkpeck@

>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.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
--
Jon K Peck
[hidden email]

===================== 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: SPSS datasets re: COVID 19

Bruce Weaver
Administrator
Here is a revised version of the code I posted earlier that includes a Python
program Jon wrote to download the CSV file.  Users will need to modify the
two FILE HANDLE commands and the final line of Jon's program--i.e., the
shutil.move line.  


* ===========================================================
*  File:    Import_owid_covid_data.sps .
*  Date:    8-May-2020 .
*  Author:  Bruce Weaver, [hidden email] .
* =========================================================== .

* Import "Our World in Data" COVID data set from CSV file.
* Download the CSV file from:
  https://ourworldindata.org/coronavirus
* Then modify the following FILE HANDLE commands
* to indicate where you saved it on your hard disk
* and where you want to save the .SAV file.

FILE HANDLE CSVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.csv".
FILE HANDLE SAVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.sav".

*******************************************************************.
* Use Python program from Jon Peck to download the CSV file.
* Modify path & file name on shutil.move line as needed.
*******************************************************************.
BEGIN PROGRAM python3.
import urllib.request, urllib.parse
import shutil
uri = "https://covid.ourworldindata.org/data/owid-covid-data.csv"
try:
    localfile, headers = urllib.request.urlretrieve(uri)
except:
    print("file retrieval failed")
shutil.move(localfile, r"C:/bw/Data/COVID19/owid-covid-data.csv")
END PROGRAM.
*******************************************************************.

* Now import the data.
NEW FILE.
DATASET CLOSE ALL.

PRESERVE.
SET DECIMAL DOT.

GET DATA  /TYPE=TXT
  /FILE= "CSVfile"
  /ENCODING='UTF8'
  /DELIMITERS=","
  /QUALIFIER='"'
  /ARRANGEMENT=DELIMITED
  /FIRSTCASE=2
  /DATATYPEMIN PERCENTAGE=95.0
  /VARIABLES=
  iso_code AUTO
  location AUTO
  date sdate10
  total_cases AUTO
  new_cases AUTO
  total_deaths AUTO
  new_deaths AUTO
  total_cases_per_million AUTO
  new_cases_per_million AUTO
  total_deaths_per_million AUTO
  new_deaths_per_million AUTO
  total_tests AUTO
  new_tests AUTO
  total_tests_per_thousand AUTO
  new_tests_per_thousand AUTO
  tests_units AUTO
  /MAP.
RESTORE.
CACHE.

STRING ImportDate (A11).
COMPUTE ImportDate = $DATE11.
ALTER TYPE ImportDate (DATE11).
DESCRIPTIVES date ImportDate /STATISTICS=MIN MAX.
* Compare MAX values of date and ImportDate to
* confirm that the data are up-to-date.  

SAVE OUTFILE = "SAVfile".

* =========================================================== .



-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
Reply | Threaded
Open this post in threaded view
|

Re: SPSS datasets re: COVID 19

Bruce Weaver
Administrator
Jon sent me this update to his Python program.  This version allows you to
use the CSVfile file handle on the shutil.move line.  This makes life a bit
easier, as users only have to modify the two FILE HANDLE commands as needed.  


begin program python3.
import urllib.request, urllib.parse
import shutil
from spssaux import FileHandles

uri = "https://covid.ourworldindata.org/data/owid-covid-data.csv"

CSVfile = FileHandles().resolve("CSVfile")
try:
    localfile, headers = urllib.request.urlretrieve(uri)
except:
    print("file retrieval failed")
shutil.move(localfile, CSVfile)
end program.



Bruce Weaver wrote

> Here is a revised version of the code I posted earlier that includes a
> Python
> program Jon wrote to download the CSV file.  Users will need to modify the
> two FILE HANDLE commands and the final line of Jon's program--i.e., the
> shutil.move line.  
>
>
> * ===========================================================
> *  File:    Import_owid_covid_data.sps .
> *  Date:    8-May-2020 .
> *  Author:  Bruce Weaver,

> bweaver@

>  .
> * =========================================================== .
>
> * Import "Our World in Data" COVID data set from CSV file.
> * Download the CSV file from:
>   https://ourworldindata.org/coronavirus
> * Then modify the following FILE HANDLE commands
> * to indicate where you saved it on your hard disk
> * and where you want to save the .SAV file.
>
> FILE HANDLE CSVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.csv".
> FILE HANDLE SAVfile /NAME="C:/bw/Data/COVID19/owid-covid-data.sav".
>
> *******************************************************************.
> * Use Python program from Jon Peck to download the CSV file.
> * Modify path & file name on shutil.move line as needed.
> *******************************************************************.
> BEGIN PROGRAM python3.
> import urllib.request, urllib.parse
> import shutil
> uri = "https://covid.ourworldindata.org/data/owid-covid-data.csv"
> try:
>     localfile, headers = urllib.request.urlretrieve(uri)
> except:
>     print("file retrieval failed")
> shutil.move(localfile, r"C:/bw/Data/COVID19/owid-covid-data.csv")
> END PROGRAM.
> *******************************************************************.
>
> * Now import the data.
> NEW FILE.
> DATASET CLOSE ALL.
>
> PRESERVE.
> SET DECIMAL DOT.
>
> GET DATA  /TYPE=TXT
>   /FILE= "CSVfile"
>   /ENCODING='UTF8'
>   /DELIMITERS=","
>   /QUALIFIER='"'
>   /ARRANGEMENT=DELIMITED
>   /FIRSTCASE=2
>   /DATATYPEMIN PERCENTAGE=95.0
>   /VARIABLES=
>   iso_code AUTO
>   location AUTO
>   date sdate10
>   total_cases AUTO
>   new_cases AUTO
>   total_deaths AUTO
>   new_deaths AUTO
>   total_cases_per_million AUTO
>   new_cases_per_million AUTO
>   total_deaths_per_million AUTO
>   new_deaths_per_million AUTO
>   total_tests AUTO
>   new_tests AUTO
>   total_tests_per_thousand AUTO
>   new_tests_per_thousand AUTO
>   tests_units AUTO
>   /MAP.
> RESTORE.
> CACHE.
>
> STRING ImportDate (A11).
> COMPUTE ImportDate = $DATE11.
> ALTER TYPE ImportDate (DATE11).
> DESCRIPTIVES date ImportDate /STATISTICS=MIN MAX.
> * Compare MAX values of date and ImportDate to
> * confirm that the data are up-to-date.  
>
> SAVE OUTFILE = "SAVfile".
>
> * =========================================================== .
>
>
>
> -----
> --
> Bruce Weaver

> bweaver@

> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.