KEEP variables with regex pattern

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

KEEP variables with regex pattern

oggesjolin
Hi!

Is it possible to save outfile and /KEEP = variables based on regex or
naming pattern?







--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: KEEP variables with regex pattern

Jon Peck
Yes.  Install the SPSSINC SELECT VARIABLES extension command via Extensions > Extension Hub if you don't already have it.  Then with it you can create a macro listing all the variables that match the regex (and other conditions such as measurement level).  The regex is case insensitive and anchored to the start of the variable name,

For example,
spssinc select variables macroname = !age
/properties pattern = ".*age".
would select all variables where the name contains age.
Then use that macro in your syntax
save outfile ... /keep = !age/

On Thu, Dec 17, 2020 at 9:19 AM oggesjolin <[hidden email]> wrote:
Hi!

Is it possible to save outfile and /KEEP = variables based on regex or
naming pattern?







--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD