Those are good suggestions. Nanci, can you attach the syntax file, please?
On Fri, Jan 17, 2025 at 9:53 AM Frans Houweling <fhouwel...@email.it> wrote: > Could it have to do with line endings or long lines, or character encoding > (like utf-32 instead of utf-8)? That is what "1.215-1.225" (row 1 columns > 215 to 225) and > > > | > ^~~~~~~~~~~ > > suggest to me. > > > On 1/17/25 18:31, Nanci Avitable wrote: > > I'm afraid there might be something else going on which may have to do > with the fact that this is actually an intel based program and I'm running > it on a Mac silicon with Rosetta 2 installed. Rosetta is what enables > silicon Macs to run intell programs, theoretically. I've also had the > program crash several times. Thanks -- Nanci > > Anyhow doing as you suggest gets the following output: > > /Users/nanciavitable/Cloud-drive/Private > Practice/Scoring&Report/ABASIII/ABASmacro.sps:1.215-1.225: error: DEFINE: > Syntax error expecting macro body or !ENDDEFINE. > > 1 | define !subscore3 (!pos !tokens(1)/!pos !enclose('(',')')/!pos > !tokens(1)) > > !LET !limits = !2 > > !DO !ssc = 1 !TO 19 > > !LET !limit = !HEAD(!limits) > > !LET !limits = !TAIL(!limits) > > if (!1 ge !limit) !3 = !ssc. > > !DOEND > > !enddefine. > > > > !subscore3 ctraw (0 10 14 18 22 26 30 34 38 42 46 49 52 55 58 62 65 100 > 100) ct. > > LIST. > > | > ^~~~~~~~~~~ > > define !subscore3 (!pos !tokens(1)/!pos !enclose('(',')')/!pos !tokens(1)) > > !LET !limits = !2 > > !DO !ssc = 1 !TO 19 > > !LET !limit = !HEAD(!limits) > > !LET !limits = !TAIL(!limits) > > if (!1 ge !limit) !3 = !ssc. > > !DOEND > > !enddefine. > > > > !subscore3 ctraw (0 10 14 18 22 26 30 34 38 42 46 49 52 55 58 62 65 100 > 100) ct. > > LIST. > > > > On 1/16/25 3:16 PM, fhouwel...@email.it wrote: > > Don't worry about the DATA LIST: just replace the define.. !enddefine part > in your syntax. The DATA LIST and what follows was just there to show the > macro works. > > Il 16 gen 2025 23:05, Nanci Avitable <avitab...@aaahawk.com> > <avitab...@aaahawk.com> ha scritto: > > Frans, > > Thank you. I suspected that there might be a problem with Do Repeat. > > I have tried your syntax, but it is not working as expected. I wonder if > there is a difference in the PSPP programs we are using. Mine did not like > the Data List Free and when I removed that it said there was an error with > IF parsing the expression. I will play with this some more now that I know > Do Repeat could be a problem. > > On 1/16/25 1:29 PM, Frans Houweling wrote: > > I'm afraid DO REPEAT does not work well inside DEFINE. Here is a > workaround: > > define !subscore3 (!pos !tokens(1)/!pos !enclose('(',')')/!pos !tokens(1)) > !LET !limits = !2 > !DO !ssc = 1 !TO 19 > !LET !limit = !HEAD(!limits) > !LET !limits = !TAIL(!limits) > if (!1 ge !limit) !3 = !ssc. > !DOEND > !enddefine. > > I put an exclamation point before subscore3 to distinguish it from your > original. > > DATA LIST FREE /ctraw. > BEGIN DATA > 63 > END DATA. > !subscore33 ctraw (0 10 14 18 22 26 30 34 38 42 46 49 52 55 58 62 65 100 > 100) ct. > LIST. > > Data List > +-----+-----+ > |ctraw| ct | > +-----+-----+ > |63.00|16.00| > +-----+-----+ > > HTH, frans > On 1/15/25 19:33, Nanci Avitable wrote: > > I am working on a new MacBookPro, M4 chip with Sequoia. I have downloaded > and installed the PSPP version 2.0.1-2 bundle. > > I have several SPSS programs that I use to score some protocols and output > information for use in WORD via mail merge. > > These programs include Define routines. Although the information I've read > indicates that they should transfer okay, I'm running into problems. It may > be that I don't fully understand when to use periods and things like "+". > Below is a syntax portion that I've been trying to get to run. The actual > program is around 1300 lines long so I'm just focusing on a small bit. > > My interpretation from the error messages is that there is something wrong > with the "if" statement. Unless the problem is that Do Repeat cannot be > used in a macro body. > > Thanks for whatever information you can give me about using Define > properly. -- Nanci > > Data list / ctraw cutraw fatraw sltraw hstraw ltraw sctraw sdtraw straw > (9f3). > Begin data. > 45 37 52 52 42 35 54 43 46 > end data. > > set Printback on. > set mprint yes. > > define subscore3 (!pos !tokens(1)/!pos !enclose('(',')')/!pos !tokens(1)) > do repeat ssc = 1 to 19/limit = !2. > if (!1 ge limit) !3 = ssc. > end repeat. > !enddefine. > > do repeat ssc = 1 to 19 / limit = 0 10 14 18 22 26 30 34 38 42 46 49 52 55 > 58 62 65 100 100. > if(ctraw ge limit)ct = ssc. > end repeat. > > /Users/nanciavitable/Cloud-drive/Private > Practice/Scoring&Report/ABASIII/ABASmacro.sps:7.1-7.78: error: DO REPEAT: > In syntax expanded from `subscore3 ctraw (0 10 14 18 22 26 30 34 38 42 46 > 49 52 55 58...': Syntax error expecting END REPEAT. > 7 | subscore3 ctraw (0 10 14 18 22 26 30 34 38 42 46 49 52 55 58 62 65 > 100 100) ct. > | > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > /Users/nanciavitable/Cloud-drive/Private > Practice/Scoring&Report/ABASIII/ABASmacro.sps:7.1-7.78: error: END REPEAT: > In syntax expanded from `subscore3 ctraw (0 10 14 18 22 26 30 34 38 42 46 > 49 52 55 58...': No matching DO REPEAT. > 7 | subscore3 ctraw (0 10 14 18 22 26 30 34 38 42 46 49 52 55 58 62 65 > 100 100) ct. > | > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > subscore3 ctraw (0 10 14 18 22 26 30 34 38 42 46 49 52 55 58 62 65 100 > 100) ct. > > > > > > >