News from the SPSS Community

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

News from the SPSS Community

Jon K Peck
A new extension command, STATS CARTPROD, has been uploaded to the SPSS Community website (www.ibm.com/developerworks/spssdevcentral) in the Extension Commands collection.  It computes the Cartesian product of two sets of variables in the same or separate datasets and writes the result to a sav file and opens it.  While not as fast as this operation would be in a database, it is quite general and preserves all variable properties.  (All the data operations are carried out with traditional Statistics syntax, but Python code is used to generate that syntax.)

This command requires the Python Essentials.  The Essentials can be obtained via the Community site or the Statistics product materials, depending on the Statistics version.  The extension command can be downloaded from the Extension Commands collection or installed directly using Utilities > Download and Install Extension Bundles with Statistics version 22.

Regards,


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621
Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

Kirill Orlov
Jon,
1) Cartesian product is simple to do in MATRIX.

MATRIX.
COMPUTE X1= {'A';'B';'C'}.
COMPUTE X2= {'1';'2';'3';'4'}.
COMPUTE X1X2= {KRONEKER(X1,MAKE(NROW(X2),1,1)),KRONEKER(MAKE(NROW(X1),1,1),X2)}.
PRINT X1X2 /format= a1.
END MATRIX.

Please, name the advantages of your extension command over the above syntax.

2) Is it possible to get into the actual SPSS syntax which hides behind the extension command? Because I'm interested.

Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

Kirill Orlov
In reply to this post by Jon K Peck
P.S.
Cartesian product of 3+ sets is easily done by the same approach of consequtive products of 2 sets.
For example, 3 sets:.

MATRIX.
COMPUTE X1= {'A';'B';'C'}.
COMPUTE X2= {'1';'2';'3';'4'}.
COMPUTE X3= {'+';'-'}.
COMPUTE X2X3= {KRONEKER(X2,MAKE(NROW(X3),1,1)),KRONEKER(MAKE(NROW(X2),1,1),X3)}.
COMPUTE X1X2X3= {KRONEKER(X1,MAKE(NROW(X2X3),1,1)),KRONEKER(MAKE(NROW(X1),1,1),X2X3)}.
PRINT X1X2X3 /format= a1.
END MATRIX.

Clearly, this task for any number of sets is looping task (macro or usual), so one can write a function.

Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

Albert-Jan Roskam
In reply to this post by Jon K Peck
Nice. I rarely need a Cartesian product though; in R it sometimes happens when I make a mistake. Nevertheless I thought about creating such an extension command before, by using SQLite. You have the option between in-memory and file-based with Sqlite. But I suppose that pushing and fetching the data is not very efficient, even with an in-memory database.

 
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?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



From: Jon K Peck <[hidden email]>
To: [hidden email]
Sent: Tuesday, March 4, 2014 10:32 PM
Subject: [SPSSX-L] News from the SPSS Community

A new extension command, STATS CARTPROD, has been uploaded to the SPSS Community website (www.ibm.com/developerworks/spssdevcentral) in the Extension Commands collection.  It computes the Cartesian product of two sets of variables in the same or separate datasets and writes the result to a sav file and opens it.  While not as fast as this operation would be in a database, it is quite general and preserves all variable properties.  (All the data operations are carried out with traditional Statistics syntax, but Python code is used to generate that syntax.)

This command requires the Python Essentials.  The Essentials can be obtained via the Community site or the Statistics product materials, depending on the Statistics version.  The extension command can be downloaded from the Extension Commands collection or installed directly using Utilities > Download and Install Extension Bundles with Statistics version 22.

Regards,


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


Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

Kirill Orlov
In reply to this post by Jon K Peck
P.P.S.
And here comes the promised MATRIX macrofunction. I'll add it to my site.

!cartprod(PREFIX%NSETS%RESULT).
*PREFIX - prefix in the names of the sets (may be quoted), NSETS - number of the sets.
*For example, X and 3 means sets X1 X2 X3.
*A set may consist of any number of columns (it's not important). Elements of a set are its ROWS.

define !cartprod(!pos= !token(1) /!pos= !charend('%') /!pos= !charend('%') /!pos= !charend(')'))

comp !4= !conc(!unquote(!2),!3).
!do !i= !3 !to 1 !by -1
 !if (!i<>!3) !then !let !set= !conc(!unquote(!2),!i)
- comp !4= {kroneker(!set,make(nrow(!4),1,1)),kroneker(make(nrow(!set),1,1),!4)}.
 !ifend
!doend
!enddefine.

*Example.

MATRIX.
COMPUTE X1= {'A';'B';'C'}.
COMPUTE X2= {'1';'2';'3';'4'}.
COMPUTE X3= {'+';'-'}.
!cartprod('x'%3%prod).
PRINT prod /format= a4.
end matrix.

Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

David Marso
Administrator
In reply to this post by Kirill Orlov
P.S.S.

DEFINE KronSets (!POS !TOKENS(1) / !POS !CMDEND).
!LET !M1=!HEAD(!2) !LET !M2=!HEAD(!TAIL(!2))
COMPUTE !1={KRONEKER(!M1,MAKE(NROW(!M2),1,1)),KRONEKER(MAKE(NROW(!M1),1,1),!M2)}.
!IF (!TAIL(!TAIL(!2)) !NE !NULL ) !THEN
KronSets !1 !1 !TAIL(!TAIL(!2)).
!IFEND
!ENDDEFINE .

MATRIX.
 COMPUTE X1= {'A';'B';'C'}.
 COMPUTE X2= {'1';'2';'3';'4'}.
 COMPUTE X3= {'+';'-'}.
 COMPUTE X4= {'x';'y';'z'}.
 COMPUTE X5= {'@';'!';'%'}.
KronSets OUTMAT X1 X2 X3 X4 X5.
PRINT OUTMAT / FORMAT "A1".
END MATRIX.
OUTMAT
 A 1 + x @
 A 1 + x !
 A 1 + x %
 A 1 + y @
 A 1 + y !
 A 1 + y %
 A 1 + z @
 A 1 + z !
 A 1 + z %
 A 1 - x @
 A 1 - x !
 A 1 - x %
 A 1 - y @
 A 1 - y !
 A 1 - y %
 A 1 - z @
 A 1 - z !
 A 1 - z %
 A 2 + x @
 A 2 + x !
 A 2 + x %
 A 2 + y @
 A 2 + y !
 A 2 + y %
 A 2 + z @
 A 2 + z !
 A 2 + z %
 A 2 - x @
 A 2 - x !
 A 2 - x %
 A 2 - y @
 A 2 - y !
 A 2 - y %
 A 2 - z @
 A 2 - z !
 A 2 - z %
 A 3 + x @
 A 3 + x !
 A 3 + x %
 A 3 + y @
 A 3 + y !
 A 3 + y %
 A 3 + z @
 A 3 + z !
 A 3 + z %
 A 3 - x @
 A 3 - x !
 A 3 - x %
 A 3 - y @
 A 3 - y !
 A 3 - y %
 A 3 - z @
 A 3 - z !
 A 3 - z %
 A 4 + x @
 A 4 + x !
 A 4 + x %
 A 4 + y @
 A 4 + y !
 A 4 + y %
 A 4 + z @
 A 4 + z !
 A 4 + z %
 A 4 - x @
 A 4 - x !
 A 4 - x %
 A 4 - y @
 A 4 - y !
 A 4 - y %
 A 4 - z @
 A 4 - z !
 A 4 - z %
 B 1 + x @
 B 1 + x !
 B 1 + x %
 B 1 + y @
 B 1 + y !
 B 1 + y %
 B 1 + z @
 B 1 + z !
 B 1 + z %
 B 1 - x @
 B 1 - x !
 B 1 - x %
 B 1 - y @
 B 1 - y !
 B 1 - y %
 B 1 - z @
 B 1 - z !
 B 1 - z %
 B 2 + x @
 B 2 + x !
 B 2 + x %
 B 2 + y @
 B 2 + y !
 B 2 + y %
 B 2 + z @
 B 2 + z !
 B 2 + z %
 B 2 - x @
 B 2 - x !
 B 2 - x %
 B 2 - y @
 B 2 - y !
 B 2 - y %
 B 2 - z @
 B 2 - z !
 B 2 - z %
 B 3 + x @
 B 3 + x !
 B 3 + x %
 B 3 + y @
 B 3 + y !
 B 3 + y %
 B 3 + z @
 B 3 + z !
 B 3 + z %
 B 3 - x @
 B 3 - x !
 B 3 - x %
 B 3 - y @
 B 3 - y !
 B 3 - y %
 B 3 - z @
 B 3 - z !
 B 3 - z %
 B 4 + x @
 B 4 + x !
 B 4 + x %
 B 4 + y @
 B 4 + y !
 B 4 + y %
 B 4 + z @
 B 4 + z !
 B 4 + z %
 B 4 - x @
 B 4 - x !
 B 4 - x %
 B 4 - y @
 B 4 - y !
 B 4 - y %
 B 4 - z @
 B 4 - z !
 B 4 - z %
 C 1 + x @
 C 1 + x !
 C 1 + x %
 C 1 + y @
 C 1 + y !
 C 1 + y %
 C 1 + z @
 C 1 + z !
 C 1 + z %
 C 1 - x @
 C 1 - x !
 C 1 - x %
 C 1 - y @
 C 1 - y !
 C 1 - y %
 C 1 - z @
 C 1 - z !
 C 1 - z %
 C 2 + x @
 C 2 + x !
 C 2 + x %
 C 2 + y @
 C 2 + y !
 C 2 + y %
 C 2 + z @
 C 2 + z !
 C 2 + z %
 C 2 - x @
 C 2 - x !
 C 2 - x %
 C 2 - y @
 C 2 - y !
 C 2 - y %
 C 2 - z @
 C 2 - z !
 C 2 - z %
 C 3 + x @
 C 3 + x !
 C 3 + x %
 C 3 + y @
 C 3 + y !
 C 3 + y %
 C 3 + z @
 C 3 + z !
 C 3 + z %
 C 3 - x @
 C 3 - x !
 C 3 - x %
 C 3 - y @
 C 3 - y !
 C 3 - y %
 C 3 - z @
 C 3 - z !
 C 3 - z %
 C 4 + x @
 C 4 + x !
 C 4 + x %
 C 4 + y @
 C 4 + y !
 C 4 + y %
 C 4 + z @
 C 4 + z !
 C 4 + z %
 C 4 - x @
 C 4 - x !
 C 4 - x %
 C 4 - y @
 C 4 - y !
 C 4 - y %
 C 4 - z @
 C 4 - z !
 C 4 - z %

Kirill Orlov wrote
P.S.
Cartesian product of 3+ sets is easily done by the same approach of
consequtive products of 2 sets.
For example, 3 sets:.

MATRIX.
COMPUTE X1= {'A';'B';'C'}.
COMPUTE X2= {'1';'2';'3';'4'}.
COMPUTE X3= {'+';'-'}.
COMPUTE X2X3=
{KRONEKER(X2,MAKE(NROW(X3),1,1)),KRONEKER(MAKE(NROW(X2),1,1),X3)}.
COMPUTE X1X2X3=
{KRONEKER(X1,MAKE(NROW(X2X3),1,1)),KRONEKER(MAKE(NROW(X1),1,1),X2X3)}.
PRINT X1X2X3 /format= a1.
END MATRIX.

Clearly, this task for any number of sets is looping task (macro or
usual), so one can write a function.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

Kirill Orlov
I see, David. You could not resist applying the recursive macro idea of which you are an authority. +1 for that. However, it is questionable if this refined approach is more efficient than simple cycling, given that the task is elementary.

05.03.2014 13:41, David Marso пишет:
P.S.S.

DEFINE KronSets (!POS !TOKENS(1) / !POS !CMDEND).
!LET !M1=!HEAD(!2) !LET !M2=!HEAD(!TAIL(!2))
COMPUTE
!1={KRONEKER(!M1,MAKE(NROW(!M2),1,1)),KRONEKER(MAKE(NROW(!M1),1,1),!M2)}.
!IF (!TAIL(!TAIL(!2)) !NE !NULL ) !THEN
*KronSets* !1 !1 !TAIL(!TAIL(!2)).
!IFEND
!ENDDEFINE .


Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

David Marso
Administrator
This has nothing to do with efficiency per se.  I would argue for elegance and aesthetics ;-)
BTW:  I posted my recursive solution before I had read your cycling version.
---
Here is a slight refinement of my original version.

DEFINE RecurKronProd (!POS !TOKENS(1) / !POS !CMDEND).
COMPUTE !1={KRONEKER(!HEAD(!2),MAKE(NROW(!HEAD(!TAIL(!2))),1,1)),
            KRONEKER(MAKE(NROW(!HEAD(!2)),1,1),!HEAD(!TAIL(!2)))}.
!IF (!TAIL(!TAIL(!2)) !NE !NULL ) !THEN
RecurKronProd !1 !1 !TAIL(!TAIL(!2)).
!IFEND
!ENDDEFINE .

MATRIX.
 COMPUTE X1= {'A';'B'}.
 COMPUTE X2= {'1';'2';'3'}.
 COMPUTE X3= {'+';'-'}.
 COMPUTE X4= {'x';'y';'z'}.
 COMPUTE X5= {'@';'!';'%'}.
RecurKronProd OUTMAT X1 X2 X3 X4 X5.
PRINT OUTMAT / FORMAT "A1".
END MATRIX.

Kirill Orlov wrote
I see, David. You could not resist applying the recursive macro idea of
which you are an authority. +1 for that. However, it is questionable if
this refined approach is more efficient than simple cycling, given that
the task is elementary.

05.03.2014 13:41, David Marso ?????:
> P.S.S.
>
> DEFINE KronSets (!POS !TOKENS(1) / !POS !CMDEND).
> !LET !M1=!HEAD(!2) !LET !M2=!HEAD(!TAIL(!2))
> COMPUTE
> !1={KRONEKER(!M1,MAKE(NROW(!M2),1,1)),KRONEKER(MAKE(NROW(!M1),1,1),!M2)}.
> !IF (!TAIL(!TAIL(!2)) !NE !NULL ) !THEN
> *KronSets* !1 !1 !TAIL(!TAIL(!2)).
> !IFEND
> !ENDDEFINE .
>
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

Jon K Peck
In reply to this post by Kirill Orlov
No doubt MATRIX works well in some cases, and would be faster than STATS CARTPROD when applicable.

Advantages of the extension command:
- no memory limits
- no variable type or name restrictions
- preserves all metadata
- requires only standard syntax - no MATRIX or macro knowledge required
- includes syntax help via STATS CARTPROD /HELP.
- clear error messages
- log shows only the high level syntax making it easier to read the job output
- packaging means it is automatically available in any session including dialog box interface once installed

Since the extension actually operates through regular Statistics transformation commands, it is only a convenience, although Python code is able to get the case counts easily which is difficult to do with standard syntax.

The Statistics syntax it generates is not directly visible, but if you examine the STATS_CARTPROD.py file that is extracted from the spe when the extension is installed, you can see it pretty clearly in the docart function.

p.s. If you use the recently published STATS PROJECT extension command, you could have your macro libraries and settings automatically loaded when Statistics starts.


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




From:        Kirill Orlov <[hidden email]>
To:        [hidden email],
Date:        03/04/2014 11:53 PM
Subject:        Re: [SPSSX-L] News from the SPSS Community
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Jon,
1) Cartesian product is simple to do in MATRIX.

MATRIX.
COMPUTE X1= {'A';'B';'C'}.
COMPUTE X2= {'1';'2';'3';'4'}.
COMPUTE X1X2= {KRONEKER(X1,MAKE(NROW(X2),1,1)),KRONEKER(MAKE(NROW(X1),1,1),X2)}.
PRINT X1X2 /format= a1.
END MATRIX.

Please, name the advantages of your extension command over the above syntax.

2) Is it possible to get into the actual SPSS syntax which hides behind the extension command? Because I'm interested.

Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

Richard Ristow
By the by --

At 09:04 AM 3/5/2014, Jon K Peck wrote:

>Since the extension actually operates through regular Statistics
>transformation commands, it is only a convenience, although Python
>code is able to get the case counts easily which is difficult to do
>with standard syntax.

Why do you say that? It's quite easy to get case counts with
AGGREGATE and MATCH FILES; I do it that way all the time.

=====================
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: News from the SPSS Community

Jon K Peck
Because that requires an entire data pass and creation of a new dataset or replication of the count in a casewise variable and subsequent retrieval code.  Python has an api that returns the count without those consequences as long as Statistics has that information.


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




From:        Richard Ristow <[hidden email]>
To:        Jon K Peck/Chicago/IBM@IBMUS, [hidden email],
Date:        03/10/2014 07:24 AM
Subject:        Re: News from the SPSS Community




By the by --

At 09:04 AM 3/5/2014, Jon K Peck wrote:

>Since the extension actually operates through regular Statistics
>transformation commands, it is only a convenience, although Python
>code is able to get the case counts easily which is difficult to do
>with standard syntax.

Why do you say that? It's quite easy to get case counts with
AGGREGATE and MATCH FILES; I do it that way all the time.


Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

David Marso
Administrator
In reply to this post by Richard Ristow
This is a VERY FAST alternative.
DATASET DECLARE nOfCases.
MATRIX.
GET x / FILE * .
SAVE NROW(x) / OUTFILE nOfCases/ VARIABLES N.
END MATRIX.
DATASET ACTIVATE nOfCases.
PRINT / N.
EXECUTE.

The BUGs in matrix which prevent all of this CARTPROD/Many2Many business from being done quite generally with great ease in MATRIX are the lack of support for reading DATASETS rather than disk or * and the requirement to run SPLIT FILE processing in 'BATCH mode'.  Building Richard's 'spine' can be done easily with KRONEKER.

Richard Ristow wrote
By the by --

At 09:04 AM 3/5/2014, Jon K Peck wrote:

>Since the extension actually operates through regular Statistics
>transformation commands, it is only a convenience, although Python
>code is able to get the case counts easily which is difficult to do
>with standard syntax.

Why do you say that? It's quite easy to get case counts with
AGGREGATE and MATCH FILES; I do it that way all the time.

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

Kirill Orlov
In MATRIX, I believe, functions NROW and NCOLS are automatically recomputed every time a variable is modified. So these are "fast functions": value is already there, waiting.
I always said that SPSS should have automatic system variable (constant) $ncases. It would be more convenient than to worry AGGREGATE command when one wants to know the number of cases.


10.03.2014 17:57, David Marso пишет:
This is a VERY FAST alternative.
DATASET DECLARE nOfCases.
MATRIX.
GET x / FILE * .
SAVE NROW(x) / OUTFILE nOfCases/ VARIABLES N.
END MATRIX.
DATASET ACTIVATE nOfCases.
PRINT / N.
EXECUTE.

The BUGs in matrix which prevent all of this CARTPROD/Many2Many business
from being done quite generally with great ease in MATRIX are the lack of
support for reading DATASETS rather than disk or * and the requirement to
run SPLIT FILE processing in 'BATCH mode'.  Building Richard's 'spine' can
be done easily with KRONEKER.


Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

Jon K Peck
The MATRIX approach requires a data pass, and the value would be awkward to use in syntax.  MATRIX, of course, would also be memory limited.
Statistics does keep the case count as a variable internally, but it is not exposed except through programmability apis.  It is, however, not always known.  If the data is a non-SPSS source, and the data have not been passed, the value is unknown.


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




From:        Kirill Orlov <[hidden email]>
To:        [hidden email],
Date:        03/10/2014 08:37 AM
Subject:        Re: [SPSSX-L] News from the SPSS Community
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




In MATRIX, I believe, functions NROW and NCOLS are automatically recomputed every time a variable is modified. So these are "fast functions": value is already there, waiting.
I always said that SPSS should have automatic system variable (constant) $ncases. It would be more convenient than to worry AGGREGATE command when one wants to know the number of cases.


10.03.2014 17:57, David Marso пишет:
This is a VERY FAST alternative.
DATASET DECLARE nOfCases.
MATRIX.
GET x / FILE * .
SAVE NROW(x) / OUTFILE nOfCases/ VARIABLES N.
END MATRIX.
DATASET ACTIVATE nOfCases.
PRINT / N.
EXECUTE.

The BUGs in matrix which prevent all of this CARTPROD/Many2Many business
from being done quite generally with great ease in MATRIX are the lack of
support for reading DATASETS rather than disk or * and the requirement to
run SPLIT FILE processing in 'BATCH mode'.  Building Richard's 'spine' can
be done easily with KRONEKER.



Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

David Marso
Administrator
In reply to this post by Jon K Peck
I have the extension installed, but STATS_CARTPROD.py does not seem to appear anywhere on my system.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

Jon K Peck
You should see it on the Data menu below Merge Files.  And if the syntax definition is in place and you have restarted Statistics, you should see STATS CARTPROD in the syntax window popup when you type STATS.


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




From:        David Marso <[hidden email]>
To:        [hidden email],
Date:        03/10/2014 09:38 AM
Subject:        Re: [SPSSX-L] News from the SPSS Community
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




I have the extension installed, but STATS_CARTPROD.py does not seem to appear
anywhere on my system.



-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/News-from-the-SPSS-Community-tp5724729p5724795.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: News from the SPSS Community

Jon K Peck
In reply to this post by David Marso
Bear in mind that (1) Kroneker product multiplication does not make sense for strings, although MATRIX will do it.


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




From:        David Marso <[hidden email]>
To:        [hidden email],
Date:        03/10/2014 07:58 AM
Subject:        Re: [SPSSX-L] News from the SPSS Community
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




This is a VERY FAST alternative.
DATASET DECLARE nOfCases.
MATRIX.
GET x / FILE * .
SAVE NROW(x) / OUTFILE nOfCases/ VARIABLES N.
END MATRIX.
DATASET ACTIVATE nOfCases.
PRINT / N.
EXECUTE.

The BUGs in matrix which prevent all of this CARTPROD/Many2Many business
from being done quite generally with great ease in MATRIX are the lack of
support for reading DATASETS rather than disk or * and the requirement to
run SPLIT FILE processing in 'BATCH mode'.  Building Richard's 'spine' can
be done easily with KRONEKER.


Richard Ristow wrote
> By the by --
>
> At 09:04 AM 3/5/2014, Jon K Peck wrote:
>
>>Since the extension actually operates through regular Statistics
>>transformation commands, it is only a convenience, although Python
>>code is able to get the case counts easily which is difficult to do
>>with standard syntax.
>
> Why do you say that? It's quite easy to get case counts with
> AGGREGATE and MATCH FILES; I do it that way all the time.
>
> =====================
> 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





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/News-from-the-SPSS-Community-tp5724729p5724790.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: News from the SPSS Community

David Marso
Administrator
In reply to this post by Jon K Peck
Jon,
You had previously replied to Kirill's note:
"The Statistics syntax it generates is not directly visible, but if you examine the STATS_CARTPROD.py file that is extracted from the spe when the extension is installed, you can see it pretty clearly in the docart function."

I can't locate the .py file.  Does it get extracted to any specific location?
The menu is misspelled Catesian product.  
The dialog opens, but I wouldn't mind studying the code to see what's under the hood.

Jon K Peck wrote
You should see it on the Data menu below Merge Files.  And if the syntax
definition is in place and you have restarted Statistics, you should see
STATS CARTPROD in the syntax window popup when you type STATS.


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




From:   David Marso <[hidden email]>
To:     [hidden email],
Date:   03/10/2014 09:38 AM
Subject:        Re: [SPSSX-L] News from the SPSS Community
Sent by:        "SPSSX(r) Discussion" <[hidden email]>



I have the extension installed, but STATS_CARTPROD.py does not seem to
appear
anywhere on my system.



-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to
email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos
ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in
abyssum?"
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/News-from-the-SPSS-Community-tp5724729p5724795.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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: News from the SPSS Community

Jon K Peck
The location of the Python file varies by your machine configuration and, to some extent, your Statistics version.  Run
SHOW EXT
to see the possible locations of the .py file.  In the case of multiples, the first matching location on the list is used.
The XML file defining the legal syntax will be in that same location.


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




From:        David Marso <[hidden email]>
To:        [hidden email],
Date:        03/10/2014 11:54 AM
Subject:        Re: [SPSSX-L] News from the SPSS Community
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Jon,
You had previously replied to Kirill's note:
"The Statistics syntax it generates is not directly visible, but if you
examine the STATS_CARTPROD.py file that is extracted from the spe when the
extension is installed, you can see it pretty clearly in the docart
function."

I can't locate the .py file.  Does it get extracted to any specific
location?
The menu is misspelled Catesian product.
The dialog opens, but I wouldn't mind studying the code to see what's under
the hood.


Jon K Peck wrote
> You should see it on the Data menu below Merge Files.  And if the syntax
> definition is in place and you have restarted Statistics, you should see
> STATS CARTPROD in the syntax window popup when you type STATS.
>
>
> Jon Peck (no "h") aka Kim
> Senior Software Engineer, IBM

> peck@.ibm

> phone: 720-342-5621
>
>
>
>
> From:   David Marso &lt;

> david.marso@

> &gt;
> To:

> SPSSX-L@.uga

> ,
> Date:   03/10/2014 09:38 AM
> Subject:        Re: [SPSSX-L] News from the SPSS Community
> Sent by:        "SPSSX(r) Discussion" &lt;

> SPSSX-L@.uga

> &gt;
>
>
>
> I have the extension installed, but STATS_CARTPROD.py does not seem to
> appear
> anywhere on my system.
>
>
>
> -----
> Please reply to the list and not to my personal email.
> Those desiring my consulting or training services please feel free to
> email me.
> ---
> "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos
> ne forte conculcent eas pedibus suis."
> Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in
> abyssum?"
> --
> View this message in context:
>
http://spssx-discussion.1045642.n5.nabble.com/News-from-the-SPSS-Community-tp5724729p5724795.html
>
> Sent from the SPSSX Discussion mailing list archive at 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





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/News-from-the-SPSS-Community-tp5724729p5724803.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: News from the SPSS Community

Richard Ristow
In reply to this post by Jon K Peck
One more note on extensions:

At 09:04 AM 3/5/2014, Jon K Peck wrote:

>Since the extension actually operates through regular Statistics
>transformation commands, it is only a convenience, although Python
>code is able to get the case counts easily which is difficult to do
>with standard syntax.

I'd rank Python as more than a convenience, even for extensions that
do all data manipulation and statistics through native SPSS.

Python's 'scripting' ability -- to take action based on the contents
of data dictionaries, data files, or output -- can be invaluable in
determining what code to generate, or to run. For example, you can
(and you did at least some of these in STATS CARTPROD),
. Give intelligible error messages and abort in cases where, for
example, an input file that doesn't exist was specified, or where
keys or other necessary variables aren't  present.
. Be cognizant of what variables and datasets currently exist; and
automatically select non-conflicting names for scratch storage

Besides, you could use the scripting capability to run and then
verify a transitive closure :-D

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