Reading ZIPPED file into SPSS

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

Reading ZIPPED file into SPSS

ajay atluri
Hi Team,
 
I have a file which is in ZIP format (PKZIP and WINRAR). The size of the file is 107 MB.  If I am extracting this file this comes out to be 478 MB.
 
The format of the file is DAT.
 
Can any one please let me know how to read the file in SPSS 16.0. Syntax is appreciated.
 
Thanks,
Ajay
Reply | Threaded
Open this post in threaded view
|

Re: Reading ZIPPED file into SPSS

Albert-Jan Roskam
hi!

You can use Python, either with internal zip functionality or external (Winzip):
import subprocess
subprocess.Popen("wzzunzip -ybc d:/temp/zipped.zip")

Alternatively, you can use the HOST command.

Then, follow the Read Text Data wizard to read the .dat.

Cheers!!
Albert-Jan

--- On Tue, 3/31/09, ajay atluri <[hidden email]> wrote:

> From: ajay atluri <[hidden email]>
> Subject: Reading ZIPPED file into SPSS
> To: [hidden email]
> Date: Tuesday, March 31, 2009, 11:31 AM
> Hi Team,
>
> I have a file which is in ZIP format (PKZIP and
> WINRAR). The size of the file is 107 MB.  If I am
> extracting this file this comes out to be 478 MB.
>
> The format of the file is DAT.
>
> Can any one please let me know how to read the file in
> SPSS 16.0. Syntax is appreciated.
>
> Thanks,
> Ajay
>

=====================
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: Reading ZIPPED file into SPSS

Heidi Green
Hello Albert-Jan:
Could you provide a bit more information on this? It sounds like
something that could save me time, since a lot of my data comes in as
.zip files (I usually use WinZip). I'm a Python newbie, I've really only
used the packaged programs on Developer Central. I tried to run the
syntax below (my zipped file is C:/Ziptemp/RTLMC0902.zip),

BEGIN PROGRAM.
IMPORT subprocess
subprocess.Popen("wzzunzip -ybc C:/Ziptemp/RTLMC0902.zip")
END PROGRAM.

But I received this result:

File "<string>", line 2
    IMPORT subprocess
                    ^
SyntaxError: invalid syntax


Is this part: ["wzzunzip -ybc] something I need to change to customize
to my file location?

Thanks,
-Heidi


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Albert-jan Roskam
Sent: Tuesday, March 31, 2009 4:29 AM
To: [hidden email]
Subject: Re: Reading ZIPPED file into SPSS

hi!

You can use Python, either with internal zip functionality or external
(Winzip):
import subprocess
subprocess.Popen("wzzunzip -ybc d:/temp/zipped.zip")

Alternatively, you can use the HOST command.

Then, follow the Read Text Data wizard to read the .dat.

Cheers!!
Albert-Jan

--- On Tue, 3/31/09, ajay atluri <[hidden email]> wrote:

> From: ajay atluri <[hidden email]>
> Subject: Reading ZIPPED file into SPSS
> To: [hidden email]
> Date: Tuesday, March 31, 2009, 11:31 AM
> Hi Team,
>
> I have a file which is in ZIP format (PKZIP and
> WINRAR). The size of the file is 107 MB.  If I am
> extracting this file this comes out to be 478 MB.
>
> The format of the file is DAT.
>
> Can any one please let me know how to read the file in
> SPSS 16.0. Syntax is appreciated.
>
> Thanks,
> Ajay
>

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

----------------

Defender MX2 - QLAN

=====================
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: Reading ZIPPED file into SPSS

Albert-Jan Roskam
In reply to this post by ajay atluri
Hi Heidi!

Python is case-sensitive. You should write 'import' in lower case. But now that you emailed, I suddenly remembered that the DOS functionality of Winzip may not be present in your system. At least in older Winzip versions a tiny, free, additional program needed to be downloaded from winzip.com. But if I were you I'd try the same command but with 'import' in lower case before doing anything else.

Good luck!!
Albert-Jan



--- On Tue, 3/31/09, Heidi Green <[hidden email]> wrote:

> From: Heidi Green <[hidden email]>
> Subject: RE:      Re: Reading ZIPPED file into SPSS
> To: "Albert-jan Roskam" <[hidden email]>, [hidden email]
> Date: Tuesday, March 31, 2009, 5:33 PM
> Hello Albert-Jan:
> Could you provide a bit more information on this? It sounds
> like
> something that could save me time, since a lot of my data
> comes in as
> .zip files (I usually use WinZip). I'm a Python newbie,
> I've really only
> used the packaged programs on Developer Central. I tried to
> run the
> syntax below (my zipped file is C:/Ziptemp/RTLMC0902.zip),
>
> BEGIN PROGRAM.
> IMPORT subprocess
> subprocess.Popen("wzzunzip -ybc C:/Ziptemp/RTLMC0902.zip")
> END PROGRAM.
>
> But I received this result:
>
> File "<string>", line 2
>     IMPORT subprocess
>
>     ^
> SyntaxError: invalid syntax
>
>
> Is this part: ["wzzunzip -ybc] something I need to change
> to customize
> to my file location?
>
> Thanks,
> -Heidi
>
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]]
> On Behalf Of
> Albert-jan Roskam
> Sent: Tuesday, March 31, 2009 4:29 AM
> To: [hidden email]
> Subject: Re: Reading ZIPPED file into SPSS
>
> hi!
>
> You can use Python, either with internal zip functionality
> or external
> (Winzip):
> import subprocess
> subprocess.Popen("wzzunzip -ybc d:/temp/zipped.zip")
>
> Alternatively, you can use the HOST command.
>
> Then, follow the Read Text Data wizard to read the .dat.
>
> Cheers!!
> Albert-Jan
>
> --- On Tue, 3/31/09, ajay atluri <[hidden email]>
> wrote:
>
> > From: ajay atluri <[hidden email]>
> > Subject: Reading ZIPPED file into SPSS
> > To: [hidden email]
> > Date: Tuesday, March 31, 2009, 11:31 AM
> > Hi Team,
> >
> > I have a file which is in ZIP format (PKZIP and
> > WINRAR). The size of the file is 107 MB.  If I
> am
> > extracting this file this comes out to be 478 MB.
> >
> > The format of the file is DAT.
> >
> > Can any one please let me know how to read the file
> in
> > SPSS 16.0. Syntax is appreciated.
> >
> > Thanks,
> > Ajay
> >
>
> =====================
> 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
>
> ----------------
>
> Defender MX2 - QLAN
>
>

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