This post was updated on .
Hi:
Might be it is a easy one. However I am unable to find the solution. Actually I am looking for a syntax in Macro where I have to add two passing variable i.e. !LET !f = Sum (!ARG1,!ARG2) OR !LET !f = !ARG1 + !ARG2 the above syntax's are not working. So can any one let me know the correct/workable solution for my query. Note: No new variables should be created in this process. Thanks. |
You would think it would be an easy one (I'm sure there is plenty of posts on this subject in the archives)...
Can't get a more comprehensive guide on this than: http://spsstools.net/de/plaintext/ArithmeticWithMacroVariables.txt/ |
In reply to this post by jagadishpchary
The best solution is to use Python programmability for this sort of thing. On Tue, Jan 19, 2016 at 9:03 AM, jagadishpchary <[hidden email]> wrote: Hi: |
Administrator
|
In reply to this post by Jignesh Sutar
"/* This code cannot be encapsulated in macros called from other macros. This
/* is because assignments such as "!let !a = !add(6,2)" do not work; SPSS /* will not recognize any tokens following the macro name "!add"." Not to be a contrarian or anything but the above is REALLY not the case if you think about it a bit or maybe a lot? or way too much, ( certainly helps to be a bit mad ;-))). I posted code on MACRO return values sometime last year (or was it the year previous?). ---- SET MPRINT ON PRINTBACK ON. DEFINE !Add (!POS !TOKENS(1) /!POS !TOKENS(1)/!POS !TOKENS(1)) !SUBSTR(!UNQUOTE(!3),3) !LENGTH( !CONCAT( !BLANKS(!1),!BLANKS(!2) ) ) . !ENDDEFINE. DEFINE !Caller (!POS !TOKENS(1)) !IF (!1 !EQ ?) !THEN !ADD 1 3 '/*!Caller' . !ELSE ECHO 'In Main'. ECHO !QUOTE(!1). !IFEND !ENDDEFINE. !Caller ? .
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?" |
Free forum by Nabble | Edit this page |