Fw: [SPSSX-L] DELETE VARIABLES: What version did it make its appearance?

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

Fw: [SPSSX-L] DELETE VARIABLES: What version did it make its appearance?

Jon K Peck
---

From:        Jon K Peck/Chicago/IBM
To:        [hidden email], [hidden email],
Date:        05/07/2013 08:15 PM
Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it make its              appearance?



Ten minutes includes a dialog box,  a syntax definition that will result in coherent error messages if something is wrong, color coding in the Syntax Editor, and installation packaging so you never have to remember to load the macro definitions once you have installed the command.

But if pushed I could do it in two :-)


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




From:        Bruce Weaver <[hidden email]>
To:        [hidden email],
Date:        05/07/2013 08:02 PM
Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it make its              appearance?
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Ten minutes?  Extension commands must be harder to write than macros.  :-)

This is untested, so I hope it works after that crack about extension
commands.  ;-)

DEFINE KeepVars (Vars = !CMDEND)
MATCH FILES / FILE = * / KEEP !Vars .
EXECUTE.
!ENDDEFINE.

KeepVars Vars = tom dick harry uncle_tom_cobley.




Jon K Peck wrote
> It would take about ten minutes to create a STATS KEEP VARIABLES extension
> command with Python :-)
>
>
> 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:   05/07/2013 04:36 PM
> Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it make
> its              appearance?
> Sent by:        "SPSSX(r) Discussion" &lt;

> SPSSX-L@.uga

> &gt;
>
>
>
> FWIW:
> MATCH FILES / FILE * / KEEP varlist
> will suffice .
> I was thinking more in terms of symmetry in the language.
>
> My usage is something like
>
> Define a macro which has an optional statistics list .
> All the stats get computed but typically only a few are of interest to the
> user.
> My MATRIX program saves identifiers and ALL of the stats and then does a
>
> MATCH FILES / FILE * / KEEP ids !stats .
>
> This prunes the data set to the ids and requested STATS .
>
> That is NOT readily achieved using DELETE VARIABLES.
>
> Alternatively I could just save the subset of STATS but that is fairly
> painful to code within MATRIX.
>
>
>
> kwame woei wrote
>> I second that. I find it extremely annoying that a function like KEEP
>> VARIABLES does not exists.
>>
>>
>> Op 7 mei 2013 om 23:41 heeft "David Marso" &lt;
>
>> david.marso@
>
>> &gt; het volgende geschreven:
>>
>>> Thanks Jon,
>>> I know it doesn't reside in 11.5, so I was checking.
>>> BTW:  It would be nice to have a sister operator:
>>> KEEP VARIABLES.
>>>
>>>
>>> jkpeck wrote
>>>> As it says in the CSR, the  history covers changes post SPSS 12, so
> you
>>>> can assume that DELETE VARIABLES has been there for a very long time.
> I
>>>> can't test that assertion that far back, however.
>>>
>>>
>>>
>>>
>>>
>>> -----
>>> 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/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720047.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
>>
>> =====================
>> 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/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720050.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





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

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720059.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: Fw: [SPSSX-L] DELETE VARIABLES: What version did it make its appearance?

David Marso
Administrator
Maybe you could take 20 minutes and post a step by step HOW TO ;-)

Jon K Peck wrote
---

From:   Jon K Peck/Chicago/IBM
To:     [hidden email], [hidden email],
Date:   05/07/2013 08:15 PM
Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it make
its              appearance?


Ten minutes includes a dialog box,  a syntax definition that will result
in coherent error messages if something is wrong, color coding in the
Syntax Editor, and installation packaging so you never have to remember to
load the macro definitions once you have installed the command.

But if pushed I could do it in two :-)


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




From:   Bruce Weaver <[hidden email]>
To:     [hidden email],
Date:   05/07/2013 08:02 PM
Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it make
its              appearance?
Sent by:        "SPSSX(r) Discussion" <[hidden email]>



Ten minutes?  Extension commands must be harder to write than macros.  :-)

This is untested, so I hope it works after that crack about extension
commands.  ;-)

DEFINE KeepVars (Vars = !CMDEND)
MATCH FILES / FILE = * / KEEP !Vars .
EXECUTE.
!ENDDEFINE.

KeepVars Vars = tom dick harry uncle_tom_cobley.




Jon K Peck wrote
> It would take about ten minutes to create a STATS KEEP VARIABLES
extension
> command with Python :-)
>
>
> Jon Peck (no "h") aka Kim
> Senior Software Engineer, IBM

> peck@.ibm

> phone: 720-342-5621
>
>
>
>
> From:   David Marso <

> david.marso@

> >
> To:

> SPSSX-L@.uga

> ,
> Date:   05/07/2013 04:36 PM
> Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it
make
> its              appearance?
> Sent by:        "SPSSX(r) Discussion" <

> SPSSX-L@.uga

> >
>
>
>
> FWIW:
> MATCH FILES / FILE * / KEEP varlist
> will suffice .
> I was thinking more in terms of symmetry in the language.
>
> My usage is something like
>
> Define a macro which has an optional statistics list .
> All the stats get computed but typically only a few are of interest to
the
> user.
> My MATRIX program saves identifiers and ALL of the stats and then does a
>
> MATCH FILES / FILE * / KEEP ids !stats .
>
> This prunes the data set to the ids and requested STATS .
>
> That is NOT readily achieved using DELETE VARIABLES.
>
> Alternatively I could just save the subset of STATS but that is fairly
> painful to code within MATRIX.
>
>
>
> kwame woei wrote
>> I second that. I find it extremely annoying that a function like KEEP
>> VARIABLES does not exists.
>>
>>
>> Op 7 mei 2013 om 23:41 heeft "David Marso" <
>
>> david.marso@
>
>> > het volgende geschreven:
>>
>>> Thanks Jon,
>>> I know it doesn't reside in 11.5, so I was checking.
>>> BTW:  It would be nice to have a sister operator:
>>> KEEP VARIABLES.
>>>
>>>
>>> jkpeck wrote
>>>> As it says in the CSR, the  history covers changes post SPSS 12, so
> you
>>>> can assume that DELETE VARIABLES has been there for a very long time.
> I
>>>> can't test that assertion that far back, however.
>>>
>>>
>>>
>>>
>>>
>>> -----
>>> 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/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720047.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
>>
>> =====================
>> 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/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720050.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





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

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720059.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: Fw: [SPSSX-L] DELETE VARIABLES: What version did it make its appearance?

Rajeshms
Hi Bruce,

Your macro works but it works for only one variable. For eg. If  I had 3 variables and if I use your macro to keep only 1 variable it deletes the one unwanted and keeps the rest 2 variables in the data. I thought it will keep the variables what we list it. Is this correct?


On Wed, May 8, 2013 at 1:30 PM, David Marso <[hidden email]> wrote:
Maybe you could take 20 minutes and post a step by step HOW TO ;-)


Jon K Peck wrote
> ---
>
> From:   Jon K Peck/Chicago/IBM
> To:

> bweaver@

> ,

> spssx-l@.uga

> ,
> Date:   05/07/2013 08:15 PM
> Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it make
> its              appearance?
>
>
> Ten minutes includes a dialog box,  a syntax definition that will result
> in coherent error messages if something is wrong, color coding in the
> Syntax Editor, and installation packaging so you never have to remember to
> load the macro definitions once you have installed the command.
>
> But if pushed I could do it in two :-)
>
>
> Jon Peck (no "h") aka Kim
> Senior Software Engineer, IBM

> peck@.ibm

> phone: <a href="tel:720-342-5621" value="+17203425621">720-342-5621
>
>
>
>
> From:   Bruce Weaver &lt;

> bruce.weaver@

> &gt;
> To:

> SPSSX-L@.uga

> ,
> Date:   05/07/2013 08:02 PM
> Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it make
> its              appearance?
> Sent by:        "SPSSX(r) Discussion" &lt;

> SPSSX-L@.uga

> &gt;
>
>
>
> Ten minutes?  Extension commands must be harder to write than macros.  :-)
>
> This is untested, so I hope it works after that crack about extension
> commands.  ;-)
>
> DEFINE KeepVars (Vars = !CMDEND)
> MATCH FILES / FILE = * / KEEP !Vars .
> EXECUTE.
> !ENDDEFINE.
>
> KeepVars Vars = tom dick harry uncle_tom_cobley.
>
>
>
>
> Jon K Peck wrote
>> It would take about ten minutes to create a STATS KEEP VARIABLES
> extension
>> command with Python :-)
>>
>>
>> Jon Peck (no "h") aka Kim
>> Senior Software Engineer, IBM
>
>> peck@.ibm
>
>> phone: <a href="tel:720-342-5621" value="+17203425621">720-342-5621
>>
>>
>>
>>
>> From:   David Marso &lt;
>
>> david.marso@
>
>> &gt;
>> To:
>
>> SPSSX-L@.uga
>
>> ,
>> Date:   05/07/2013 04:36 PM
>> Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it
> make
>> its              appearance?
>> Sent by:        "SPSSX(r) Discussion" &lt;
>
>> SPSSX-L@.uga
>
>> &gt;
>>
>>
>>
>> FWIW:
>> MATCH FILES / FILE * / KEEP varlist
>> will suffice .
>> I was thinking more in terms of symmetry in the language.
>>
>> My usage is something like
>>
>> Define a macro which has an optional statistics list .
>> All the stats get computed but typically only a few are of interest to
> the
>> user.
>> My MATRIX program saves identifiers and ALL of the stats and then does a
>>
>> MATCH FILES / FILE * / KEEP ids !stats .
>>
>> This prunes the data set to the ids and requested STATS .
>>
>> That is NOT readily achieved using DELETE VARIABLES.
>>
>> Alternatively I could just save the subset of STATS but that is fairly
>> painful to code within MATRIX.
>>
>>
>>
>> kwame woei wrote
>>> I second that. I find it extremely annoying that a function like KEEP
>>> VARIABLES does not exists.
>>>
>>>
>>> Op 7 mei 2013 om 23:41 heeft "David Marso" &lt;
>>
>>> david.marso@
>>
>>> &gt; het volgende geschreven:
>>>
>>>> Thanks Jon,
>>>> I know it doesn't reside in 11.5, so I was checking.
>>>> BTW:  It would be nice to have a sister operator:
>>>> KEEP VARIABLES.
>>>>
>>>>
>>>> jkpeck wrote
>>>>> As it says in the CSR, the  history covers changes post SPSS 12, so
>> you
>>>>> can assume that DELETE VARIABLES has been there for a very long time.
>> I
>>>>> can't test that assertion that far back, however.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> -----
>>>> 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/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720047.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
>>>
>>> =====================
>>> 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/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720050.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
>
>
>
>
>
> -----
> --
> 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.
>
> --
> View this message in context:
> http://spssx-discussion.1045642.n5.nabble.com/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720059.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/Fw-SPSSX-L-DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720061p5720068.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



--
Regards,

Rajesh M S




Reply | Threaded
Open this post in threaded view
|

Re: Fw: [SPSSX-L] DELETE VARIABLES: What version did it make its appearance?

David Marso
Administrator
AFAICT it works perfectly.  OTOH it is just as easy to type MATCH FILES ...KEEP ...

DEFINE KeepVars (Vars = !CMDEND)
MATCH FILES / FILE = * / KEEP !Vars .
EXECUTE.
!ENDDEFINE.

DATA LIST FREE / a b c tom dick harry uncle_tom_cobley.
BEGIN DATA
6 3 5 1 5 3 1 6 3 1 7 3 5 7
END DATA .
LIST .
KeepVars Vars = tom dick harry uncle_tom_cobley.
LIST .

     a      b      c    tom   dick  harry uncle_tom_cobley

6.0000 3.0000 5.0000 1.0000 5.0000 3.0000      1.0000
6.0000 3.0000 1.0000 7.0000 3.0000 5.0000      7.0000

Number of cases read:  2    Number of cases listed:  2
 
KeepVars Vars = tom dick harry uncle_tom_cobley.
LIST .

   tom   dick  harry uncle_tom_cobley

1.0000 5.0000 3.0000      1.0000
7.0000 3.0000 5.0000      7.0000


Number of cases read:  2    Number of cases listed:  2

Rajeshms wrote
Hi Bruce,

Your macro works but it works for only one variable. For eg. If  I had 3
variables and if I use your macro to keep only 1 variable it deletes the
one unwanted and keeps the rest 2 variables in the data. I thought it will
keep the variables what we list it. Is this correct?


On Wed, May 8, 2013 at 1:30 PM, David Marso <[hidden email]> wrote:

> Maybe you could take 20 minutes and post a step by step HOW TO ;-)
>
>
> Jon K Peck wrote
> > ---
> >
> > From:   Jon K Peck/Chicago/IBM
> > To:
>
> > bweaver@
>
> > ,
>
> > spssx-l@.uga
>
> > ,
> > Date:   05/07/2013 08:15 PM
> > Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it make
> > its              appearance?
> >
> >
> > Ten minutes includes a dialog box,  a syntax definition that will result
> > in coherent error messages if something is wrong, color coding in the
> > Syntax Editor, and installation packaging so you never have to remember
> to
> > load the macro definitions once you have installed the command.
> >
> > But if pushed I could do it in two :-)
> >
> >
> > Jon Peck (no "h") aka Kim
> > Senior Software Engineer, IBM
>
> > peck@.ibm
>
> > phone: 720-342-5621
> >
> >
> >
> >
> > From:   Bruce Weaver <
>
> > bruce.weaver@
>
> > >
> > To:
>
> > SPSSX-L@.uga
>
> > ,
> > Date:   05/07/2013 08:02 PM
> > Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it make
> > its              appearance?
> > Sent by:        "SPSSX(r) Discussion" <
>
> > SPSSX-L@.uga
>
> > >
> >
> >
> >
> > Ten minutes?  Extension commands must be harder to write than macros.
>  :-)
> >
> > This is untested, so I hope it works after that crack about extension
> > commands.  ;-)
> >
> > DEFINE KeepVars (Vars = !CMDEND)
> > MATCH FILES / FILE = * / KEEP !Vars .
> > EXECUTE.
> > !ENDDEFINE.
> >
> > KeepVars Vars = tom dick harry uncle_tom_cobley.
> >
> >
> >
> >
> > Jon K Peck wrote
> >> It would take about ten minutes to create a STATS KEEP VARIABLES
> > extension
> >> command with Python :-)
> >>
> >>
> >> Jon Peck (no "h") aka Kim
> >> Senior Software Engineer, IBM
> >
> >> peck@.ibm
> >
> >> phone: 720-342-5621
> >>
> >>
> >>
> >>
> >> From:   David Marso <
> >
> >> david.marso@
> >
> >> >
> >> To:
> >
> >> SPSSX-L@.uga
> >
> >> ,
> >> Date:   05/07/2013 04:36 PM
> >> Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it
> > make
> >> its              appearance?
> >> Sent by:        "SPSSX(r) Discussion" <
> >
> >> SPSSX-L@.uga
> >
> >> >
> >>
> >>
> >>
> >> FWIW:
> >> MATCH FILES / FILE * / KEEP varlist
> >> will suffice .
> >> I was thinking more in terms of symmetry in the language.
> >>
> >> My usage is something like
> >>
> >> Define a macro which has an optional statistics list .
> >> All the stats get computed but typically only a few are of interest to
> > the
> >> user.
> >> My MATRIX program saves identifiers and ALL of the stats and then does a
> >>
> >> MATCH FILES / FILE * / KEEP ids !stats .
> >>
> >> This prunes the data set to the ids and requested STATS .
> >>
> >> That is NOT readily achieved using DELETE VARIABLES.
> >>
> >> Alternatively I could just save the subset of STATS but that is fairly
> >> painful to code within MATRIX.
> >>
> >>
> >>
> >> kwame woei wrote
> >>> I second that. I find it extremely annoying that a function like KEEP
> >>> VARIABLES does not exists.
> >>>
> >>>
> >>> Op 7 mei 2013 om 23:41 heeft "David Marso" <
> >>
> >>> david.marso@
> >>
> >>> > het volgende geschreven:
> >>>
> >>>> Thanks Jon,
> >>>> I know it doesn't reside in 11.5, so I was checking.
> >>>> BTW:  It would be nice to have a sister operator:
> >>>> KEEP VARIABLES.
> >>>>
> >>>>
> >>>> jkpeck wrote
> >>>>> As it says in the CSR, the  history covers changes post SPSS 12, so
> >> you
> >>>>> can assume that DELETE VARIABLES has been there for a very long time.
> >> I
> >>>>> can't test that assertion that far back, however.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> -----
> >>>> 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/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720047.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
> >>>
> >>> =====================
> >>> 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/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720050.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
> >
> >
> >
> >
> >
> > -----
> > --
> > 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.
> >
> > --
> > View this message in context:
> >
> http://spssx-discussion.1045642.n5.nabble.com/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720059.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/Fw-SPSSX-L-DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720061p5720068.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
>



--
Regards,

Rajesh M S
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
|

An extension command for keeping variables

Jon K Peck
In reply to this post by David Marso
This page
https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/We70df3195ec8_4f95_9773_42e448fa9029/page/Books%20and%20Articles
in the Books and Articles section of the SPSS Community site covers how to write extension commands.  I sometimes teach a one-day course covering the CDB, extension commands, and intro to Python or R for this.

The thumbnail view
1) figure out what you want the command to do
2) create a custom dialog (optional)
3) create a small xml file that defines the command name, subcommands, and keywords
4) Using the extension.py or R equivalent module included in the plugins, write a Run function to receive the parsed syntax and map the contents to R or Python variables and call the implementing function.
5) Write the implementing function.

Typically by the time you get to step 5, all or most of the input has been error checked, so you can start from the point of valid input, although there may be additional conditions you would check in the implementing function.

Here is the complete XML definition for MARSO KEEP VARS.  The first two lines are boilerplate.  It would be saved in
MARSO_KEEP_VARS.xml.
<?xml version="1.0" encoding="UTF-8"?>
<Command xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="extension-1.0.xsd"
Name="MARSO KEEP VARS" Language="Python">
        <Subcommand Name="">
                <Parameter Name="VARIABLES" ParameterType="VariableNameList"/>
        </Subcommand>
</Command>

Here is the main part of what the Run function in MARSO_KEEP_VARS.py would look like along with the implementing function.  It would be saved in
MARSO_KEEP_VARS.py

def Run(args):
    """Run the MARSO KEEP VARS command"""

    args = args[args.keys()[0]]
    oobj = Syntax([
    Template("VARIABLES", subc="", ktype="existingvarlist", var="varlist", islist=True)])
    processcmd(oobj, args, domarso)

def domarso(varlist):
        spss.Submit(r"""MATCH FILES /FILE =* /KEEP %s""" % varlist)

A real version would provide help and provide for translation.  It would be packaged as an extension bundle (spe file) using
Utilities > Extension Bundle > Create Extension Bundle, so there is only one file to carry around.

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:        05/08/2013 02:10 AM
Subject:        Re: [SPSSX-L] Fw: [SPSSX-L] DELETE VARIABLES:  What version did              it make its              appearance?
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Maybe you could take 20 minutes and post a step by step HOW TO ;-)


Jon K Peck wrote
> ---
>
> From:   Jon K Peck/Chicago/IBM
> To:

> bweaver@

> ,

> spssx-l@.uga

> ,
> Date:   05/07/2013 08:15 PM
> Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it make
> its              appearance?
>
>
> Ten minutes includes a dialog box,  a syntax definition that will result
> in coherent error messages if something is wrong, color coding in the
> Syntax Editor, and installation packaging so you never have to remember to
> load the macro definitions once you have installed the command.
>
> But if pushed I could do it in two :-)
>
>
> Jon Peck (no "h") aka Kim
> Senior Software Engineer, IBM

> peck@.ibm

> phone: 720-342-5621
>
>
>
>
> From:   Bruce Weaver &lt;

> bruce.weaver@

> &gt;
> To:

> SPSSX-L@.uga

> ,
> Date:   05/07/2013 08:02 PM
> Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it make
> its              appearance?
> Sent by:        "SPSSX(r) Discussion" &lt;

> SPSSX-L@.uga

> &gt;
>
>
>
> Ten minutes?  Extension commands must be harder to write than macros.  :-)
>
> This is untested, so I hope it works after that crack about extension
> commands.  ;-)
>
> DEFINE KeepVars (Vars = !CMDEND)
> MATCH FILES / FILE = * / KEEP !Vars .
> EXECUTE.
> !ENDDEFINE.
>
> KeepVars Vars = tom dick harry uncle_tom_cobley.
>
>
>
>
> Jon K Peck wrote
>> It would take about ten minutes to create a STATS KEEP VARIABLES
> extension
>> command with Python :-)
>>
>>
>> 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:   05/07/2013 04:36 PM
>> Subject:        Re: [SPSSX-L] DELETE VARIABLES:  What version did it
> make
>> its              appearance?
>> Sent by:        "SPSSX(r) Discussion" &lt;
>
>> SPSSX-L@.uga
>
>> &gt;
>>
>>
>>
>> FWIW:
>> MATCH FILES / FILE * / KEEP varlist
>> will suffice .
>> I was thinking more in terms of symmetry in the language.
>>
>> My usage is something like
>>
>> Define a macro which has an optional statistics list .
>> All the stats get computed but typically only a few are of interest to
> the
>> user.
>> My MATRIX program saves identifiers and ALL of the stats and then does a
>>
>> MATCH FILES / FILE * / KEEP ids !stats .
>>
>> This prunes the data set to the ids and requested STATS .
>>
>> That is NOT readily achieved using DELETE VARIABLES.
>>
>> Alternatively I could just save the subset of STATS but that is fairly
>> painful to code within MATRIX.
>>
>>
>>
>> kwame woei wrote
>>> I second that. I find it extremely annoying that a function like KEEP
>>> VARIABLES does not exists.
>>>
>>>
>>> Op 7 mei 2013 om 23:41 heeft "David Marso" &lt;
>>
>>> david.marso@
>>
>>> &gt; het volgende geschreven:
>>>
>>>> Thanks Jon,
>>>> I know it doesn't reside in 11.5, so I was checking.
>>>> BTW:  It would be nice to have a sister operator:
>>>> KEEP VARIABLES.
>>>>
>>>>
>>>> jkpeck wrote
>>>>> As it says in the CSR, the  history covers changes post SPSS 12, so
>> you
>>>>> can assume that DELETE VARIABLES has been there for a very long time.
>> I
>>>>> can't test that assertion that far back, however.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> -----
>>>> 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/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720047.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
>>>
>>> =====================
>>> 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/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720050.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
>
>
>
>
>
> -----
> --
> 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.
>
> --
> View this message in context:
>
http://spssx-discussion.1045642.n5.nabble.com/DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720045p5720059.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/Fw-SPSSX-L-DELETE-VARIABLES-What-version-did-it-make-its-appearance-tp5720061p5720068.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
|

Python for V21 backwards compatible with SPSS v15 programs?

King Douglas
Folks,

It's like Christmas!  I've just installed SPSS v21 and its associated Python package.

I'll find out before long, but can anyone tell me if Python programs I wrote using SPSS v15 and Python should work on v21...or if I'll have to import different Python modules, make changes to the code, etc.?  I found no anwer in the archives for search terms like "Python backward compatible."

There used to be a tool for converting Python code from one version to another.  Will that be necessary and, if so, is the tool readily available?  It seems to me that older Python code (including import statements) should be valid across later versions, but maybe that's just wishful thinking.

King Douglas
Texas Instruments Marketing Research
Reply | Threaded
Open this post in threaded view
|

Re: Python for V21 backwards compatible with SPSS v15 programs?

Jon K Peck
With V21, the Python Essentials installed Python 2.7 if you didn't already have that installed. If you had your own Python modules for V15 saved under the V15 site-packages directory, you will need to copy them to the equivalent Python27 directory.  That's all you have to do.  (You could use the Python sitecustomize file to add the old location to the Python search path, instead, if it is still there.)

The only issue you might have is that if you are in Unicode mode, which didn't exist in V15, and you have extended characters in the data or metadata, it is possible that you might have to modify your string handling code, but that depends on exactly what you were doing.

Moving from V15 to V21, you will be able to take advantage of all the extension commands on the SPSS Community site that are packaged as extension bundles.  The extension bundle feature was introduced in V18.  You will also have access to Python scripting, too.

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




From:        King Douglas <[hidden email]>
To:        [hidden email],
Date:        05/08/2013 09:07 AM
Subject:        [SPSSX-L] Python for V21 backwards compatible with SPSS v15              programs?
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Folks,

It's like Christmas!  I've just installed SPSS v21 and its associated Python package.

I'll find out before long, but can anyone tell me if Python programs I wrote using SPSS v15 and Python should work on v21...or if I'll have to import different Python modules, make changes to the code, etc.?  I found no anwer in the archives for search terms like "Python backward compatible."

There used to be a tool for converting Python code from one version to another.  Will that be necessary and, if so, is the tool readily available?  It seems to me that older Python code (including import statements) should be valid across later versions, but maybe that's just wishful thinking.

King Douglas
Texas Instruments Marketing Research
Reply | Threaded
Open this post in threaded view
|

Re: Python for V21 backwards compatible with SPSS v15 programs?

King Douglas
Excellent news, Jon. I have my Python modules for V15 saved, so I'll just copy them over as you suggest.  I don't think I'm going to have any unicode problems, but thanks for the advice in any case.

I'm also and most certainly pleased that I can take advantage of the available extension commands and Python scripting.  I'm in my 25th year of SPSS programming and still having fun...and I give you due credit for the part you have played.

Regards,

King


From: Jon K Peck <[hidden email]>
To: King Douglas <[hidden email]>
Cc: [hidden email]
Sent: Wed, May 8, 2013 10:24:48 AM
Subject: Re: [SPSSX-L] Python for V21 backwards compatible with SPSS v15 programs?

With V21, the Python Essentials installed Python 2.7 if you didn't already have that installed. If you had your own Python modules for V15 saved under the V15 site-packages directory, you will need to copy them to the equivalent Python27 directory.  That's all you have to do.  (You could use the Python sitecustomize file to add the old location to the Python search path, instead, if it is still there.)

The only issue you might have is that if you are in Unicode mode, which didn't exist in V15, and you have extended characters in the data or metadata, it is possible that you might have to modify your string handling code, but that depends on exactly what you were doing.

Moving from V15 to V21, you will be able to take advantage of all the extension commands on the SPSS Community site that are packaged as extension bundles.  The extension bundle feature was introduced in V18.  You will also have access to Python scripting, too.

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




From:        King Douglas <[hidden email]>
To:        [hidden email],
Date:        05/08/2013 09:07 AM
Subject:        [SPSSX-L] Python for V21 backwards compatible with SPSS v15              programs?
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Folks,

It's like Christmas!  I've just installed SPSS v21 and its associated Python package.

I'll find out before long, but can anyone tell me if Python programs I wrote using SPSS v15 and Python should work on v21...or if I'll have to import different Python modules, make changes to the code, etc.?  I found no anwer in the archives for search terms like "Python backward compatible."

There used to be a tool for converting Python code from one version to another.  Will that be necessary and, if so, is the tool readily available?  It seems to me that older Python code (including import statements) should be valid across later versions, but maybe that's just wishful thinking.

King Douglas
Texas Instruments Marketing Research
Reply | Threaded
Open this post in threaded view
|

Re: An extension command for keeping variables

Albert-Jan Roskam
In reply to this post by Jon K Peck
<snip>


>Here is the main part of what the Run function
in MARSO_KEEP_VARS.py would look like along with the implementing function.
 It would be saved in
>MARSO_KEEP_VARS.py
>
>def Run(args):
>    """Run
the MARSO KEEP VARS command"""
>
>    args = args[args.keys()[0]]
>    oobj = Syntax([
>    Template("VARIABLES",
subc="", ktype="existingvarlist", var="varlist",
islist=True)])
>    processcmd(oobj, args,
domarso)
>
>def domarso(varlist):
>        spss.Submit(r"""MATCH
FILES /FILE =* /KEEP %s""" % varlist)
><snip>

I made something like this, way back, called PRUNE. A KEEP or DROP statement was generated so only variables used in the syntax were retained and processing went faster. That procedure simply read the entire syntax. But is there any way for SpssClient to know at what position the mouse cursor is? For instance, if the cursor is at line 100, I would like to scan the syntax from line 100 till the end and find out which variable names are used in that piece of syntax.

Regards,
Albert-Jan

=====================
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: An extension command for keeping variables

Jon K Peck
There is no access to the cursor location from Python (or Basic or Java).  And, of course, that location could change while the script is running.  The status bar records that information, so I suppose it wouldn't be too hard to add that.  But once the door was open, you would next be asking for the text that in the selection in the SE and its location.  Oh, and the selected cells in the DE, too.  You can find the selection in the Viewer.


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




From:        Albert-Jan Roskam <[hidden email]>
To:        [hidden email],
Date:        05/08/2013 11:14 AM
Subject:        Re: [SPSSX-L] An extension command for keeping variables
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




<snip>


>Here is the main part of what the Run function
in MARSO_KEEP_VARS.py would look like along with the implementing function.
It would be saved in
>MARSO_KEEP_VARS.py
>
>def Run(args):
>    """Run
the MARSO KEEP VARS command"""
>
>    args = args[args.keys()[0]]
>    oobj = Syntax([
>    Template("VARIABLES",
subc="", ktype="existingvarlist", var="varlist",
islist=True)])
>    processcmd(oobj, args,
domarso)
>
>def domarso(varlist):
>        spss.Submit(r"""MATCH
FILES /FILE =* /KEEP %s""" % varlist)
><snip>

I made something like this, way back, called PRUNE. A KEEP or DROP statement was generated so only variables used in the syntax were retained and processing went faster. That procedure simply read the entire syntax. But is there any way for SpssClient to know at what position the mouse cursor is? For instance, if the cursor is at line 100, I would like to scan the syntax from line 100 till the end and find out which variable names are used in that piece of syntax.

Regards,
Albert-Jan

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