Re: Help with macros

Posted by Bruce Weaver on
URL: http://spssx-discussion.165.s1.nabble.com/Help-with-macros-tp5740865p5740878.html

The WRITE & INSERT approach Kirill described has been referred to by some as the "horrible hack".  You can see an example of it in my 25-Jun-2013 post in this thread:

http://spssx-discussion.165.s1.nabble.com/SELECT-IF-LOOP-td5720860.html

Sorry Jon, I should have issued a trigger warning first, I suppose.  Calm yourself.  ;-)  

Kirill Orlov wrote
Eleonora
To let the macro "know" a value generated by a regular syntax (such as a value from a dataset) within the same macro you will have to use WRITE and then INSERT comnands. It is tricky and not very much convenient, but is possible.

(The reason why it is a problem is that macros and regular syntax are not on the same level to call-over between them. Macro is an "envelope" for syntax, it can pass a parameter to syntax, but not vice versa.)

It is more convenient, many users think, to do such things like your task through Python programmability than through a macro.

But I'll show in the next reply how to do it in macro.
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).