extract strings from the value labels-using macro

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

extract strings from the value labels-using macro

progster
is it posible to extract strings from the value labels of a variable in order to use them in a macro?
For instance  in ctables for putting captions.

I need just a tip in order to extract the value labels, then I guess that is something with “quote” and “concat”.
Reply | Threaded
Open this post in threaded view
|

Re: extract strings from the value labels-using macro

David Marso
Administrator
Macros have NO access to ANY metadata.  
So you are trying to use an inappropriate tool for the task.
Perhaps bark up the python tree or look into Winbasic scripting.
--
progster wrote
is it posible to extract strings from the value labels of a variable in order to use them in a macro?
For instance  in ctables for putting captions.

I need just a tip in order to extract the value labels, then I guess that is something with “quote” and “concat”.
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: extract strings from the value labels-using macro

Art Kendall
In reply to this post by progster
"VALUELABEL function

VALUELABEL. VALUELABEL(varname). String. Returns the value label for the value of variable or an empty string if there is no label for the value. The value of varname must be a variable name; it cannot be an expression.
Example

STRING labelvar (A120).
COMPUTE labelvar=VALUELABEL(var1). "

also
string bigstring (a100).
compute bigstring= concat(some words ",labelvar," more words".

You can do this outside a macro.

check the manual but i believe that the macro can deal with variables that exist in the data.

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: extract strings from the value labels-using macro

Jon K Peck
In reply to this post by progster
That would be excruciatingly difficult with macro, since it cannot see the value labels, but it would be trivially simple with a little Python code, and that code could generate a macro containing that information.

But I'm puzzled what you are after here and what that caption would look like.  If it is just a matter of documenting the association between values and labels in the table, maybe it would work to just label categories with both via the SET command.

set onumbers=both.


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




From:        progster <[hidden email]>
To:        [hidden email]
Date:        06/22/2015 09:40 AM
Subject:        [SPSSX-L] extract strings from the value labels-using macro
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




is it posible to extract strings from the value labels of a variable in order
to use them in a macro?
For instance  in ctables for putting captions.

I need just a tip in order to extract the value labels, then I guess that is
something with “quote” and “concat”.




--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/extract-strings-from-the-value-labels-using-macro-tp5729876.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


===================== 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: extract strings from the value labels-using macro

David Marso
Administrator
In reply to this post by Art Kendall
How does this help?
The return from VALUELABEL is a data value and macros cannot access the values of data.
You will not get this into anything usable within MACRO/!CONCAT without 'ugly hack'.
"macro can deal with variables that exist in the data"..
I have NO idea what this sentence is supposed to signify WRT solving the task at hand.
I think OP needs to provide a specific use case, since the request is ambiguous and likely misguided.
--
Art Kendall wrote
"VALUELABEL function

VALUELABEL. VALUELABEL(varname). String. Returns the value label for the value of variable or an empty string if there is no label for the value. The value of varname must be a variable name; it cannot be an expression.
Example

STRING labelvar (A120).
COMPUTE labelvar=VALUELABEL(var1). "

also
string bigstring (a100).
compute bigstring= concat(some words ",labelvar," more words".

You can do this outside a macro.

check the manual but i believe that the macro can deal with variables that exist in the data.
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: extract strings from the value labels-using macro

Jon K Peck
In reply to this post by Jon K Peck
Sorry.  That should be TNUMBERS=BOTH.


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




From:        Jon K Peck/Chicago/IBM@IBMUS
To:        [hidden email]
Date:        06/22/2015 10:03 AM
Subject:        Re: [SPSSX-L] extract strings from the value labels-using macro
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




That would be excruciatingly difficult with macro, since it cannot see the value labels, but it would be trivially simple with a little Python code, and that code could generate a macro containing that information.

But I'm puzzled what you are after here and what that caption would look like.  If it is just a matter of documenting the association between values and labels in the table, maybe it would work to just label categories with both via the SET command.


set onumbers=both.



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





From:        
progster <[hidden email]>
To:        
[hidden email]
Date:        
06/22/2015 09:40 AM
Subject:        
[SPSSX-L] extract strings from the value labels-using macro
Sent by:        
"SPSSX(r) Discussion" <[hidden email]>




is it posible to extract strings from the value labels of a variable in order
to use them in a macro?
For instance  in ctables for putting captions.

I need just a tip in order to extract the value labels, then I guess that is
something with “quote” and “concat”.




--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/extract-strings-from-the-value-labels-using-macro-tp5729876.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


===================== To manage your subscription to SPSSX-L, send a message to
LISTSERV@... (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 [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: extract strings from the value labels-using macro

progster
In reply to this post by David Marso

ok thanks. this is an example. the point is that my variable "segment" has several values and I don't want to create a big CROSS table with 3 variables. Instead is more useful a table like this, selecting only some values of "segment". I will develop this macro in order to asign some different segment values in the macro call.

Since I want to export to excel these tables I would like to add in the caption the correspondent value label of segment when this will change.  

DEFINE !mymacro (x1 !TOKENS(1)/x2 !TOKENS(1))
temp.
sel if segment=1.
CTABLES
  /VLABELS VARIABLES=!x1 !x2 DISPLAY=LABEL
  /TABLE !x1[C] BY !x2 [C][COUNT F40.0, ROWPCT.COUNT PCT40.1]
  /CATEGORIES VARIABLES=!x1 !x2 ORDER=A KEY=VALUE EMPTY=EXCLUDE
 /TITLES
    CAPTION='segment= ...insert value label'.
!ENDDEFINE.

!mymacro x1=var1 x2=var2.
Reply | Threaded
Open this post in threaded view
|

Re: extract strings from the value labels-using macro

Jon K Peck
Here's a little Python code that creates a macro definition named !segment that can then be used in your table caption.  It assumes that the variable is named segment and is numeric.  You would just need to change the segmentvalue line below appropriately.  As a bonus, it does the select for you, so you only have to set the value in one place.

begin program.
import spss, spssaux

segmentvalue=1

valuelabel = spssaux.VariableDict("segment")["segment"].ValueLabels[str(segmentvalue)]
spss.SetMacroValue("!segment", '"' + valuelabel + '"')
spss.Submit("select if segment eq %s." % segmentvalue)
end program.


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




From:        progster <[hidden email]>
To:        [hidden email]
Date:        06/22/2015 10:45 AM
Subject:        Re: [SPSSX-L] extract strings from the value labels-using macro
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




ok thanks. this is an example. the point is that my variable "segment" has
several values and I don't want to create a big CROSS table with 3
variables. Instead is more useful a table like this, selecting only some
values of "segment". I will develop this macro in order to asign some
different segment values in the macro call.

Since I want to export to excel these tables I would like to add in the
caption the correspondent value label of segment when this will change.  

DEFINE !mymacro (x1 !TOKENS(1)/x2 !TOKENS(1))
temp.
sel if segment=1.
CTABLES
 /VLABELS VARIABLES=!x1 !x2 DISPLAY=LABEL
 /TABLE !x1[C] BY !x2 [C][COUNT F40.0, ROWPCT.COUNT PCT40.1]
 /CATEGORIES VARIABLES=!x1 !x2 ORDER=A KEY=VALUE EMPTY=EXCLUDE
/TITLES
   CAPTION='segment= ...insert value label'.
!ENDDEFINE.

!mymacro x1=var1 x2=var2.



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/extract-strings-from-the-value-labels-using-macro-tp5729876p5729882.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


===================== 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: extract strings from the value labels-using macro

David Marso
Administrator
In reply to this post by David Marso
Here is the 'horrible hack' method ;-)
--


DEFINE !rec_tab (!POS !TOKENS(1) / !POS !TOKENS(1) /!POS !CHAREND ('/') / !POS !CMDEND )
!IF ( !HEAD (!3) !NE "")  !THEN
TEMPORARY.
SELECT IF (!1 EQ !HEAD(!3)).
CTABLES  /TABLE !1  BY !2 /TITLES  CAPTION=!QUOTE(!HEAD(!4)).
!rec_tab !1 !2 !TAIL(!3) / !TAIL(!4) .
!IFEND  
!ENDDEFINE .

MATRIX.
SAVE (TRUNC(UNIFORM(100,2)*5) +1) /OUTFILE * /VARIABLES x y.
END MATRIX.
FREQUENCIES x.
VALUE LABELS x 1 'one' 2 'two' 3 'three' 4 'four' 5 'five'.
DATASET NAME rawdata .

DATASET DECLARE agg.
STRING vallab_x (A20).
COMPUTE vallab_x=VALUELABEL(x).
AGGREGATE OUTFILE agg /BREAK x vallab_x /count=N.
DATASET ACTIVATE agg.

SELECT IF ANY(x,1,3,5).

CASESTOVARS .
WRITE OUTFILE 'C:\TEMP\tmp' / '!rec_tab x y ' x.1 TO x.3  '/' vallab_x.1 TO vallab_x.3 .
EXECUTE.
DATASET ACTIVATE rawdata.
INCLUDE  'C:\TEMP\tmp'.
ERASE FILE  'C:\TEMP\tmp'.
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: extract strings from the value labels-using macro

progster
interesting, thanx to all!

after the line "INCLUDE  'C:\TEMP\tmp'. " I see these messages

>Error # 4024 on line 69 in column 18.  Text: ,
>The sequence of operators found is invalid.  Check the expression for omitted
>or extra operands, operators, and parentheses.
>Execution of this command stops.

>Note # 213
>Due to an error, INSERT and INCLUDE file processing has been terminated.  All
>transformations since the last procedure command have been discarded.

>Note # 236
>All outstanding macros have been terminated, all INSERT and INCLUDE processing
>has been terminated, and all outstanding PRESERVE commands have been undone.

I changed the directory to another one in my pc,but in the previous sentence write outfile it works and leave there the temp file

may be my bad?
Reply | Threaded
Open this post in threaded view
|

Re: extract strings from the value labels-using macro

David Marso
Administrator
Odd.
It may be something in the Value Labels which then trip up the macro?
--
Here is a more robust version of the 'prep' code (In the original the labels would have to be single words ;-(
--

DATASET DECLARE agg.
STRING vallab_x (A20).
COMPUTE vallab_x=CONCAT("'",VALUELABEL(x),"'").
AGGREGATE OUTFILE agg /BREAK x vallab_x /count=N.
DATASET ACTIVATE agg.

progster wrote
interesting, thanx to all!

after the line "INCLUDE  'C:\TEMP\tmp'. " I see these messages

>Error # 4024 on line 69 in column 18.  Text: ,
>The sequence of operators found is invalid.  Check the expression for omitted
>or extra operands, operators, and parentheses.
>Execution of this command stops.

>Note # 213
>Due to an error, INSERT and INCLUDE file processing has been terminated.  All
>transformations since the last procedure command have been discarded.

>Note # 236
>All outstanding macros have been terminated, all INSERT and INCLUDE processing
>has been terminated, and all outstanding PRESERVE commands have been undone.

I changed the directory to another one in my pc,but in the previous sentence write outfile it works and leave there the temp file

may be my bad?
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: extract strings from the value labels-using macro

progster
still having problems...I created exactly a c:\temp directory.

just in case I tried this macro from spss.tools:

http://www.spsstools.net/Macros/MacrosVariable/CallMacroWithArgumentEQtoEachValueOfVar.sps

I have the same kind of problem when I lreach  the
"include" statement.

may be is a problem with some SPSS or windows settings?

Reply | Threaded
Open this post in threaded view
|

Re: extract strings from the value labels-using macro

David Marso
Administrator
This post was updated on .
Please research SET commands (namely MPRINT and PRINTBACK).
You are running with a blindfold and scissors ;-)
Maybe your labels are too long and you need to make obvious mods to adapt to your specific circumstances?
*EDIT-added- *
Perhaps INSERT rather than INCLUDE?
Also, you need to post the EXACT error message and exactly the commands you are running.
I hope you realize that the MATRIX - END MATRIX block is completely irrelevant to your question and is merely a data simulation.
Hard to troubleshoot in the dark without complete context.

progster wrote
still having problems...I created exactly a c:\temp directory.

just in case I tried this macro from spss.tools:

http://www.spsstools.net/Macros/MacrosVariable/CallMacroWithArgumentEQtoEachValueOfVar.sps

I have the same kind of problem when I lreach  the
"include" statement.

may be is a problem with some SPSS or windows settings?
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: extract strings from the value labels-using macro

progster
Thanks David, what I mean is that I’m having problems also running your example syntax. So for now the data generated by the matrix are ok, in order to practice.

I tried some debugging with the mprint, but still it’s too hard for me.

I copy here the output




SET MPRINT=yes /PRINTBACK=yes.

  25  0 M>  
DEFINE !rec_tab (!POS !TOKENS(1) / !POS !TOKENS(1) /!POS !CHAREND ('/') / !POS !CMDEND )
  26  0 M>  DEFINE !rec_tab (!POS !TOKENS(1) / !POS !TOKENS(1) /!POS !CHAREND ('/') / !POS !CMDEND )
!IF ( !HEAD (!3) !NE "")  !THEN
  27  0 M>  !IF ( !HEAD (!3) !NE "") !THEN
TEMPORARY.
  28  0 M>  TEMPORARY.
SELECT IF (!1 EQ !HEAD(!3)).
  29  0 M>  SELECT IF (!1 EQ !HEAD(!3)).
CTABLES  /TABLE !1  BY !2 /TITLES  CAPTION=!QUOTE(!HEAD(!4)).
  30  0 M>  CTABLES /TABLE !1 BY !2 /TITLES CAPTION=!QUOTE(!HEAD(!4)).
!rec_tab !1 !2 !TAIL(!3) / !TAIL(!4) .
  31  0 M>  !rec_tab !1 !2 !TAIL(!3) / !TAIL(!4) .
!IFEND
  32  0 M>  !IFEND
!ENDDEFINE .
  33  0 M>  !ENDDEFINE .
MATRIX.
  36  0 M>  MATRIX.
SAVE (TRUNC(UNIFORM(100,2)*5) +1) /OUTFILE * /VARIABLES x y.
  37  0 M>  SAVE (TRUNC(UNIFORM(100,2)*5) +1) /OUTFILE * /VARIABLES x y.
END MATRIX.
  38  0 M>  END MATRIX.


FREQUENCIES x.
  39  0 M>  FREQUENCIES x.




VALUE LABELS x 1 'one' 2 'two' 3 'three' 4 'four' 5 'five'.
  40  0 M>  VALUE LABELS x 1 'one' 2 'two' 3 'three' 4 'four' 5 'five'.
DATASET NAME rawdata .
  41  0 M>  DATASET NAME rawdata .
DATASET DECLARE agg.
  44  0 M>  DATASET DECLARE agg.
STRING vallab_x (A20).
  45  0 M>  STRING vallab_x (A20).
COMPUTE vallab_x=CONCAT("'",VALUELABEL(x),"'").
  46  0 M>  COMPUTE vallab_x=CONCAT("'",VALUELABEL(x),"'").
AGGREGATE OUTFILE agg /BREAK x vallab_x /count=N.
  47  0 M>  AGGREGATE OUTFILE agg /BREAK x vallab_x /count=N.
DATASET ACTIVATE agg.
  48  0 M>  DATASET ACTIVATE agg.
DATASET ACTIVATE agg.
  51  0 M>  DATASET ACTIVATE agg.
SELECT IF ANY(x,1,3,5).
  54  0 M>  SELECT IF ANY(x,1,3,5).
CASESTOVARS .
  57  0 M>  CASESTOVARS .



WRITE OUTFILE 'C:\TEMP\tmp' / '!rec_tab x y ' x.1 TO x.3  '/' vallab_x.1 TO vallab_x.3 .
  58  0 M>  WRITE OUTFILE 'C:\TEMP\tmp' / '!rec_tab x y ' x.1 TO x.3 '/' vallab_x.1 TO vallab_x.3 .
EXECUTE.
  59  0 M>  EXECUTE.
DATASET ACTIVATE rawdata.
  62  0 M>  DATASET ACTIVATE rawdata.
INCLUDE  'C:\TEMP\tmp'.
  65  0 M>  INCLUDE 'C:\TEMP\tmp'.
  65  0  !rec_tab x y     1,00    3,00    5,00/'one'               'three'             'five'
  66  0  
  66  0 M>  
  67  0 M>  TEMPORARY
  68  0 M>  SELECT IF ( x EQ 1 )
  69  0 M>  CTABLES /TABLE x BY y /TITLES CAPTION= '''one'''
  70  0 M>  



  71  0 M>  TEMPORARY
  72  0 M>  SELECT IF ( x EQ , )

Error # 4024 on line 72 in column 18.  Text: ,
The sequence of operators found is invalid.  Check the expression for omitted
or extra operands, operators, and parentheses.
Execution of this command stops.

Note # 213
Due to an error, INSERT and INCLUDE file processing has been terminated.  All
transformations since the last procedure command have been discarded.

Note # 236
All outstanding macros have been terminated, all INSERT and INCLUDE processing
has been terminated, and all outstanding PRESERVE commands have been undone.
ERASE FILE  'C:\TEMP\tmp'.
  76  0 M>  ERASE FILE 'C:\TEMP\tmp'.


With the insert file still having problems

  96  0 M>  
  97  0 M>  .
  98  0 M>  TEMPORARY.
  99  0 M>  SELECT IF ( x EQ , ).

Error # 4024 on line 99 in column 18.  Text: ,
The sequence of operators found is invalid.  Check the expression for omitted
or extra operands, operators, and parentheses.
Execution of this command stops.
 100  0 M>  CTABLES /TABLE x BY y /TITLES CAPTION= 'and'.








Reply | Threaded
Open this post in threaded view
|

Re: extract strings from the value labels-using macro

David Marso
Administrator
Decimal seperator!!!
Please see FORMAT command and SET command.

progster wrote
Thanks David, what I mean is that I’m having problems also running your example syntax. So for now the data generated by the matrix are ok, in order to practice.

I tried some debugging with the mprint, but still it’s too hard for me.

I copy here the output




SET MPRINT=yes /PRINTBACK=yes.

  25  0 M>  
DEFINE !rec_tab (!POS !TOKENS(1) / !POS !TOKENS(1) /!POS !CHAREND ('/') / !POS !CMDEND )
  26  0 M>  DEFINE !rec_tab (!POS !TOKENS(1) / !POS !TOKENS(1) /!POS !CHAREND ('/') / !POS !CMDEND )
!IF ( !HEAD (!3) !NE "")  !THEN
  27  0 M>  !IF ( !HEAD (!3) !NE "") !THEN
TEMPORARY.
  28  0 M>  TEMPORARY.
SELECT IF (!1 EQ !HEAD(!3)).
  29  0 M>  SELECT IF (!1 EQ !HEAD(!3)).
CTABLES  /TABLE !1  BY !2 /TITLES  CAPTION=!QUOTE(!HEAD(!4)).
  30  0 M>  CTABLES /TABLE !1 BY !2 /TITLES CAPTION=!QUOTE(!HEAD(!4)).
!rec_tab !1 !2 !TAIL(!3) / !TAIL(!4) .
  31  0 M>  !rec_tab !1 !2 !TAIL(!3) / !TAIL(!4) .
!IFEND
  32  0 M>  !IFEND
!ENDDEFINE .
  33  0 M>  !ENDDEFINE .
MATRIX.
  36  0 M>  MATRIX.
SAVE (TRUNC(UNIFORM(100,2)*5) +1) /OUTFILE * /VARIABLES x y.
  37  0 M>  SAVE (TRUNC(UNIFORM(100,2)*5) +1) /OUTFILE * /VARIABLES x y.
END MATRIX.
  38  0 M>  END MATRIX.


FREQUENCIES x.
  39  0 M>  FREQUENCIES x.




VALUE LABELS x 1 'one' 2 'two' 3 'three' 4 'four' 5 'five'.
  40  0 M>  VALUE LABELS x 1 'one' 2 'two' 3 'three' 4 'four' 5 'five'.
DATASET NAME rawdata .
  41  0 M>  DATASET NAME rawdata .
DATASET DECLARE agg.
  44  0 M>  DATASET DECLARE agg.
STRING vallab_x (A20).
  45  0 M>  STRING vallab_x (A20).
COMPUTE vallab_x=CONCAT("'",VALUELABEL(x),"'").
  46  0 M>  COMPUTE vallab_x=CONCAT("'",VALUELABEL(x),"'").
AGGREGATE OUTFILE agg /BREAK x vallab_x /count=N.
  47  0 M>  AGGREGATE OUTFILE agg /BREAK x vallab_x /count=N.
DATASET ACTIVATE agg.
  48  0 M>  DATASET ACTIVATE agg.
DATASET ACTIVATE agg.
  51  0 M>  DATASET ACTIVATE agg.
SELECT IF ANY(x,1,3,5).
  54  0 M>  SELECT IF ANY(x,1,3,5).
CASESTOVARS .
  57  0 M>  CASESTOVARS .



WRITE OUTFILE 'C:\TEMP\tmp' / '!rec_tab x y ' x.1 TO x.3  '/' vallab_x.1 TO vallab_x.3 .
  58  0 M>  WRITE OUTFILE 'C:\TEMP\tmp' / '!rec_tab x y ' x.1 TO x.3 '/' vallab_x.1 TO vallab_x.3 .
EXECUTE.
  59  0 M>  EXECUTE.
DATASET ACTIVATE rawdata.
  62  0 M>  DATASET ACTIVATE rawdata.
INCLUDE  'C:\TEMP\tmp'.
  65  0 M>  INCLUDE 'C:\TEMP\tmp'.
  65  0  !rec_tab x y     1,00    3,00    5,00/'one'               'three'             'five'
  66  0  
  66  0 M>  
  67  0 M>  TEMPORARY
  68  0 M>  SELECT IF ( x EQ 1 )
  69  0 M>  CTABLES /TABLE x BY y /TITLES CAPTION= '''one'''
  70  0 M>  



  71  0 M>  TEMPORARY
  72  0 M>  SELECT IF ( x EQ , )

Error # 4024 on line 72 in column 18.  Text: ,
The sequence of operators found is invalid.  Check the expression for omitted
or extra operands, operators, and parentheses.
Execution of this command stops.

Note # 213
Due to an error, INSERT and INCLUDE file processing has been terminated.  All
transformations since the last procedure command have been discarded.

Note # 236
All outstanding macros have been terminated, all INSERT and INCLUDE processing
has been terminated, and all outstanding PRESERVE commands have been undone.
ERASE FILE  'C:\TEMP\tmp'.
  76  0 M>  ERASE FILE 'C:\TEMP\tmp'.


With the insert file still having problems

  96  0 M>  
  97  0 M>  .
  98  0 M>  TEMPORARY.
  99  0 M>  SELECT IF ( x EQ , ).

Error # 4024 on line 99 in column 18.  Text: ,
The sequence of operators found is invalid.  Check the expression for omitted
or extra operands, operators, and parentheses.
Execution of this command stops.
 100  0 M>  CTABLES /TABLE x BY y /TITLES CAPTION= 'and'.
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?"