Is it possible to create own syntax commands?
Example INSERT FILE="analy.sub01.sps" SYNTAX=INTERACTIVE ERROR=STOP. OUTPUT EXPORT /CONTENTS EXPORT=VISIBLE /PDF DOCUMENTFILE = "analy.sub01.pdf". This code just repeat a lot of times. Just the filename-part "sub01" changes. Can I specify something like this MYCOMMAND PARAM1="sub01". MYCOMMAND PARAM1="sub02". with the code above in it? ===================== 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 |
Administrator
|
See DEFINE !ENDDEDFINE in the Syntax Reference. In your example you will want to look at the !CONCAT and !DO operators. There are many examples posted in this group in the past and even quite recently .
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?" |
Administrator
|
http://spssx-discussion.1045642.n5.nabble.com/template/NamlServlet.jtp?macro=search_page&node=1068821&query=%22%21DOEND%22&days=0
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?" |
In reply to this post by David Marso
On 2014-03-30 08:49 David Marso <[hidden email]> wrote:
> See DEFINE !ENDDEDFINE in the Syntax Reference. > In your example you will want to look at the !CONCAT and !DO What is the difference between CONCAT and !CONCAT? Btw: This doesn't work because there is something "missing" in the PDF command. DEFINE zkj_analy (!POS !TOKENS(1)) OUTPUT EXPORT /CONTENTS EXPORT=VISIBLE /PDF DOCUMENTFILE = CONCAT("analy.",!1,".pdf"). !ENDDEFINE. zkj_analy "tesT". -- <http://dontbubble.us/> ===================== 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 |
Administrator
|
Try this to see what is happening when you call your macro.
SET MPRINT on. zkj_analy "tesT". SET MPRINT off. This will likely give you some clues as to what you need to fix. (When working with strings, it may involve using !QUOTE or !UNQUOTE.) HTH.
--
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/). |
Administrator
|
I do it like this:
DEFINE !macro_name (define essential parameters .../ DEBUG !CMDEND !DEFAULT(0) ). PRESERVE. !IF (!DEBUG !NE 0) !THEN SET MPRINT ON PRINTBACK ON. !IFEND ..... <macro body> RESTORE. !ENDDEFINE . !macro_name <specify parameter arguments>/DEBUG=1 . To answer the question: CONCAT builds string variables, !CONCAT builds macro literals. One key is to ALWAYS make sure it works OUTSIDE a macro before turning it into a macro! As noted, use MPRINT on to see what is being expanded! ---
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 |