Controlling SPSS 17 from Excel (Microsoft Office)

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

Controlling SPSS 17 from Excel (Microsoft Office)

Boris Ratchev
Hello everyone,

I'm trying to run old code from Excel (Office 2003) which opens an SPSS instance from within MS Excel VBA, runs some frequencies, and exports some data to Excel from the SPSS output. Can't do that in the new version - the old object model apparently cannot be used any more.

I'm running SPSS 17.0.1. I understand things have changed a lot in the new SPSS version and the old SPSS Basic libraries are not available any more from within Excel VBA? What do I need to do? Any suggestions on how to do that in the new SPSS 17 will be greatly appreciated.

Thanks,

Boris Rachev
ICF International

=====================
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: Controlling SPSS 17 from Excel (Microsoft Office)

Peck, Jon
Re: [SPSSX-L] Controlling SPSS 17 from Excel (Microsoft Office)

This is still possible.  The app name is now spss.application16.  The COM apis are still supported.

Regards,
Jon Peck

----- Original Message -----
From: SPSSX(r) Discussion <[hidden email]>
To: [hidden email] <[hidden email]>
Sent: Mon Apr 20 13:01:57 2009
Subject:      [SPSSX-L] Controlling SPSS 17 from Excel (Microsoft Office)

Hello everyone,

I'm trying to run old code from Excel (Office 2003) which opens an SPSS instance from within MS Excel VBA, runs some frequencies, and exports some data to Excel from the SPSS output. Can't do that in the new version - the old object model apparently cannot be used any more.

I'm running SPSS 17.0.1. I understand things have changed a lot in the new SPSS version and the old SPSS Basic libraries are not available any more from within Excel VBA? What do I need to do? Any suggestions on how to do that in the new SPSS 17 will be greatly appreciated.

Thanks,

Boris Rachev
ICF International

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

time variable from numraic variable

Abdul Rahman Yousef El Mubark
Re: [SPSSX-L] Controlling SPSS 17 from Excel (Microsoft Office)

Hi

I have problem for creating date variable from numeric variable representing time.

Numeric Variable representing time look as below:

917

1056

2459

I want the numeric variable to be date variable representing time as below:

09:17

10:56

24:59.

For me the problem is 917 as it is length is 3 characters

 

Thanks in advance.

 

 

Abdulrahman

 



=======================================================================================================================
CONFIDENTIALITY AND DISCLAIMER NOTICE

This email and any files transmitted with it are confidential and legally privileged. This email is intended solely for the use of the individual or entity to whom it is addressed. If you have received this email in error, please delete it and notify the sender or the IT Manager of ALJ Co Ltd (e-mail [hidden email]). Access by any other person to this e-mail is not authorized. Any unauthorized use or disclosure of this e-mail or of the information contained therein or any copying, distribution, dissemination of it is prohibited, and illegal.

E-mail transmission cannot be guaranteed to be secured or error-free. ALJ Co. Ltd. and its subsidiaries/affiliates therefore, do not accept any liability whatsoever for any losses, damages, errors, omissions, corruption or viruses which could be contained within this e-mail or within any files attached/transmitted with it, or which may arise as a result of its transmission. Any views or opinions expressed by an individual within this e-mail do not necessarily reflect the views or opinions of ALJ Co. Ltd. or its subsidiaries/affiliates
=======================================================================================================================

Reply | Threaded
Open this post in threaded view
|

Re: time variable from numraic variable

Eric Langston
Re: [SPSSX-L] Controlling SPSS 17 from Excel (Microsoft Office)

Give this a shot (untested)

 

String Time_Str (A4).

Compute Time_Str = Char.Lpad ( Time , 4 , “0” ). /* This computes a string with leading zeros */

Compute Hours = Number ( Substr ( Time_Str , 1 , 2 ) , F2.0 ).

Compute Minutes = Number (Substr ( Time_Str , 3 , 2 ) , F2.0 ).

Compute Time_Final = Time.HMS ( hours , minutes ).

Formats Time_Final (time5).

Exe.

 

-Eric

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Abdul Rahman Yousef El Mubark
Sent: Tuesday, April 21, 2009 12:36 AM
To: [hidden email]
Subject: time variable from numraic variable

 

Hi

I have problem for creating date variable from numeric variable representing time.

Numeric Variable representing time look as below:

917

1056

2459

I want the numeric variable to be date variable representing time as below:

09:17

10:56

24:59.

For me the problem is 917 as it is length is 3 characters

 

Thanks in advance.

 

 

Abdulrahman

 

 


=======================================================================================================================
CONFIDENTIALITY AND DISCLAIMER NOTICE

This email and any files transmitted with it are confidential and legally privileged. This email is intended solely for the use of the individual or entity to whom it is addressed. If you have received this email in error, please delete it and notify the sender or the IT Manager of ALJ Co Ltd (e-mail [hidden email]). Access by any other person to this e-mail is not authorized. Any unauthorized use or disclosure of this e-mail or of the information contained therein or any copying, distribution, dissemination of it is prohibited, and illegal.

E-mail transmission cannot be guaranteed to be secured or error-free. ALJ Co. Ltd. and its subsidiaries/affiliates therefore, do not accept any liability whatsoever for any losses, damages, errors, omissions, corruption or viruses which could be contained within this e-mail or within any files attached/transmitted with it, or which may arise as a result of its transmission. Any views or opinions expressed by an individual within this e-mail do not necessarily reflect the views or opinions of ALJ Co. Ltd. or its subsidiaries/affiliates
=======================================================================================================================

Reply | Threaded
Open this post in threaded view
|

Re: time variable from numraic variable

Eric Langston
Re: [SPSSX-L] Controlling SPSS 17 from Excel (Microsoft Office)

The very first error sets off the rest. 

 

You already have a variable in the file called “Time_Str”. 

 

I should have prefaced this syntax with the following note:

This code will create the following working variables: Time_Str, Hours, Minutes.  If you have variables that use those names, please change the syntax to use different variable names.

The second line of code refers to the variable “Time” – this should be replaced with your time variable.  If your original time variable is stored as a string, then the code will work fine.  If your original time variable is stored as a number, please use this for the second line instead:

 

 

Compute Time_Str = Char.Lpad ( String ( Time , F4.0 ) , 4 , “0” ).

 

 

 

 

Syntax:

 

String Time_Str (A4).

Compute Time_Str = Char.Lpad ( Time , 4 , “0” ). /* This computes a string with leading zeros */

Compute Hours = Number ( Substr ( Time_Str , 1 , 2 ) , F2.0 ).

Compute Minutes = Number (Substr ( Time_Str , 3 , 2 ) , F2.0 ).

Compute Time_Final = Time.HMS ( hours , minutes ).

Formats Time_Final (time5).

Exe.

 

 

From: Abdul Rahman Yousef El Mubark [mailto:[hidden email]]
Sent: Tuesday, April 21, 2009 10:09 AM
To: Eric Langston
Subject: RE: time variable from numraic variable

 

Thanks Eric

Below is what I get when I  gave a shot for your syntax .

What is required for  your  syntax.

Regards

Abdulrahman

 

String Time_Str (A4).

 

Error # 4822 in column 8.  Text: Time_Str

A variable with this name is already defined.

This command not executed.

Compute Time_Str = Char.Lpad ( Time , 4 , “0” ).

 

Error # 4285 in column 32.  Text: Time

Incorrect variable name: either the name is more than 64 characters, or it is

not defined by a previous command.

This command not executed.

Compute Hours = Number ( Substr ( Time_Str , 1 , 2 ) , F2.0 ).

 

Error # 4311 in column 52.  Text: )

The string argument required for the function specified was not supplied.

This command not executed.

Compute Minutes = Number (Substr ( Time_Str , 3 , 2 ) , F2.0 ).

 

Error # 4311 in column 53.  Text: )

The string argument required for the function specified was not supplied.

This command not executed.

Compute Time_Final = Time.HMS ( hours , minutes ).

 

Error # 4285 in column 33.  Text: hours

Incorrect variable name: either the name is more than 64 characters, or it is

not defined by a previous command.

This command not executed.

Formats Time_Final (time5).

 

Error # 4820 in column 9.  Text: Time_Final

A variable named on the FORMATS, PRINT FORMATS, or WRITE FORMATS command has

not yet been defined.

This command not executed.

Exe.

From: Eric Langston [mailto:[hidden email]]
Sent: Tuesday, April 21, 2009 5:37 PM
To: Abdul Rahman Yousef El Mubark; [hidden email]
Subject: RE: time variable from numraic variable

 

Give this a shot (untested)

 

String Time_Str (A4).

Compute Time_Str = Char.Lpad ( Time , 4 , “0” ). /* This computes a string with leading zeros */

Compute Hours = Number ( Substr ( Time_Str , 1 , 2 ) , F2.0 ).

Compute Minutes = Number (Substr ( Time_Str , 3 , 2 ) , F2.0 ).

Compute Time_Final = Time.HMS ( hours , minutes ).

Formats Time_Final (time5).

Exe.

 

-Eric

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Abdul Rahman Yousef El Mubark
Sent: Tuesday, April 21, 2009 12:36 AM
To: [hidden email]
Subject: time variable from numraic variable

 

Hi

I have problem for creating date variable from numeric variable representing time.

Numeric Variable representing time look as below:

917

1056

2459

I want the numeric variable to be date variable representing time as below:

09:17

10:56

24:59.

For me the problem is 917 as it is length is 3 characters

 

Thanks in advance.

 

 

Abdulrahman

 

 


=======================================================================================================================
CONFIDENTIALITY AND DISCLAIMER NOTICE

This email and any files transmitted with it are confidential and legally privileged. This email is intended solely for the use of the individual or entity to whom it is addressed. If you have received this email in error, please delete it and notify the sender or the IT Manager of ALJ Co Ltd (e-mail [hidden email]). Access by any other person to this e-mail is not authorized. Any unauthorized use or disclosure of this e-mail or of the information contained therein or any copying, distribution, dissemination of it is prohibited, and illegal.

E-mail transmission cannot be guaranteed to be secured or error-free. ALJ Co. Ltd. and its subsidiaries/affiliates therefore, do not accept any liability whatsoever for any losses, damages, errors, omissions, corruption or viruses which could be contained within this e-mail or within any files attached/transmitted with it, or which may arise as a result of its transmission. Any views or opinions expressed by an individual within this e-mail do not necessarily reflect the views or opinions of ALJ Co. Ltd. or its subsidiaries/affiliates
=======================================================================================================================

Reply | Threaded
Open this post in threaded view
|

Re: time variable from numraic variable

Richard Ristow
In reply to this post by Abdul Rahman Yousef El Mubark
At 01:35 AM 4/21/2009, Abdul Rahman Yousef El Mubark wrote:

I have problem for creating date variable from numeric variable representing time. Numeric Variable representing time look as below:
|-----------------------------|---------------------------|
|Output Created               |23-APR-2009 10:47:04       |
|-----------------------------|---------------------------|
NumTime

   917
  1056
  2459

Number of cases read:  3    Number of cases listed:  3

I want the numeric variable to be date variable representing time as below:
09:17
10:56
24:59.

 
NUMERIC #Hours #Mins (F3).
COMPUTE #Mins  = MOD(NumTime,100).
COMPUTE #Hours = (NumTime - #Mins)/100.

NUMERIC TIME (TIME5).

COMPUTE TIME = TIME.HMS(#Hours,#Mins).

LIST.
|-----------------------------|---------------------------|
|Output Created               |23-APR-2009 10:53:24       |
|-----------------------------|---------------------------|
NumTime  TIME

   917   9:17
  1056  10:56
  2459  24:59

Number of cases read:  3    Number of cases listed:  3
=============================
APPENDIX: Test data, and code
=============================
DATA LIST LIST/
   NumTime
   (F4).
BEGIN DATA
   917
   1056
   2459
END DATA.  
LIST.

NUMERIC #Hours #Mins (F3).
COMPUTE #Mins  = MOD(NumTime,100).
COMPUTE #Hours = (NumTime - #Mins)/100.

NUMERIC TIME (TIME5).

COMPUTE TIME = TIME.HMS(#Hours,#Mins).

LIST.

===================== 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: time variable from numraic variable

abdelrhman elmubarak
Thanks to Eric Langston and Richard Ristow for their contribution to  my question
Abdul Rahman Yousef El Mubark 
 

Date: Thu, 23 Apr 2009 10:56:47 -0400
From: [hidden email]
Subject: Re: time variable from numraic variable
To: [hidden email]

At 01:35 AM 4/21/2009, Abdul Rahman Yousef El Mubark wrote:

I have problem for creating date variable from numeric variable representing time. Numeric Variable representing time look as below:
|-----------------------------|---------------------------|
|Output Created               |23-APR-2009 10:47:04       |
|-----------------------------|---------------------------|
NumTime

   917
  1056
  2459

Number of cases read:  3    Number of cases listed:  3

I want the numeric variable to be date variable representing time as below:
09:17
10:56
24:59.

 
NUMERIC #Hours #Mins (F3).
COMPUTE #Mins  = MOD(NumTime,100).
COMPUTE #Hours = (NumTime - #Mins)/100.

NUMERIC TIME (TIME5).

COMPUTE TIME = TIME.HMS(#Hours,#Mins).

LIST.
|-----------------------------|---------------------------|
|Output Created               |23-APR-2009 10:53:24       |
|-----------------------------|---------------------------|
NumTime  TIME

   917   9:17
  1056  10:56
  2459  24:59

Number of cases read:  3    Number of cases listed:  3
=============================
APPENDIX: Test data, and code
=============================
DATA LIST LIST/
   NumTime
  ! ; (F4).
BEGIN DATA
   917
   1056
   2459
END DATA.  
LIST.

NUMERIC #Hours #Mins (F3).
COMPUTE #Mins  = MOD(NumTime,100).
COMPUTE #Hours = (NumTime - #Mins)/100.

NUMERIC TIME (TIME5).

COMPUTE TIME = TIME.HMS(#Hours,#Mins).

LIST.

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


Get news, entertainment and everything you care about at Live.com. Check it out!