I am trying to replicate this command using a for loop to make it more concise:
GROUP Q1_all_all Q1CIL1 Q1CIL2 Q1CIL3 Q1CONTAM1 Q1CONTAM2 Q1CONTAM3 Q1FEDINSPEC1 Q1FEDINSPEC2 Q1FEDINSPEC3 Q1GAP1 Q1GAP2 Q1GAP3 Q1GLOBALGAP1 Q1GLOBALGAP2 Q1GLOBALGAP3 Q1GMP1 Q1GMP2 Q1GMP3 Q1HACCP1 Q1HACCP2 Q1HACCP3 Q1ISO141 Q1ISO142 Q1ISO143 Q1ORGPROD1 Q1ORGPROD2 Q1ORGPROD3 Q1SEGURIDAD1 Q1SEGURIDAD2 Q1SEGURIDAD3 Q1SUPREME1 Q1SUPREME2 Q1SUPREME3 Q1USNOP1 Q1USNOP2 Q1USNOP3
Each series name ends in either 1, 2, and 3. This was my attempt:
for %i Q1CIL Q1CONTAM Q1FEDINSPEC Q1GAP Q1GLOBALGAP Q1GMP Q1HACCP Q1ISO14 Q1ORGPROD Q1SEGURIDAD Q1SUPREME Q1USNOP
for !j=1 to 3
GROUP Q1_all_all {%i}{!j}
next
next
but it doesn't work because each inner loop only groups one variable, which gets overwritten each iteration, and the whole inner loop gets overwritten each iteration by the outer loop.
Is there some way to get it to list all the combinations of {%i}{!j} and group them?
Cheers
for loops to create groups
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13305
- Joined: Tue Sep 16, 2008 5:38 pm
Re: for loops to create groups
You could use group.add, rather than redefining the group each time.
Follow us on Twitter @IHSEViews
Re: for loops to create groups
Worked great. Thanks!
Who is online
Users browsing this forum: No registered users and 9 guests