Execute selective portions of syntax
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | * QUESTION: >In SAS there is a way to comment out an entire block of command lines by >beginning with /* and ending with */ (I may have these reversed). Does >anyone know of a similar command in SPSS? For example, let's say I have >100 commands of syntax that runs five similar operations, each twenty >commands long (call them part a,b,c,d,e) and I want to run parts b and e >while blocking out a,c,d. Other than highlighting b and e with the >mouse and clicking on 'run current', I must put a comment (*) before >each command in order to block out the unwanted part. But if I could >block out large sections in one fell swoop I wouldn't have to search 100 >commands for (.) and (*). > >Any help would be greatly appreciated. * SOLUTION posted by rlevesqeu@videotron.ca to spss newsgroup on 2001/07/8. One option solution is to 1. save the five parts as five differrent syntax file named a.sps, b.sps, c.sps, etc 2. write a new syntax file (named, say, All5.sps) made up of the following 5 lines: INCLUDE FILE="(path)\\a.sps". INCLUDE FILE="(path)\\b.sps". INCLUDE FILE="(path)\\c.sps". INCLUDE FILE="(path)\\d.sps". INCLUDE FILE="(path)\\e.sps". 3. When you execute All5.sps all 5 pieces of syntax are executed. 4. If you want to run only b and e, all you have to do is add a * at the beginning of lines 1, 3 and 4. 5. Alternatively, you could also define a macro such as DEFINE !dothis (!POS=!CMDEND) !LET !path="c:\\temp\\" !DO !nb !IN (!1) INCLUDE FILE=!QUOTE(!CONCAT(!path,!nb,".sps")). !DOEND !ENDDEFINE. and call the macro like this !dothis b e. to do only parts b and e. DEFINE !dothis (!POS=!CMDEND) !LET !path="c:\\temp\\" !DO !nb !IN (!1) INCLUDE FILE=!QUOTE(!CONCAT(!path,!nb,".sps")). !DOEND !ENDDEFINE. !dothis b e. |
Related pages
...