for loop with strings and alpha series
Posted: Thu Feb 13, 2025 9:41 am
Hello
I would like to create new alpha variables with the for loop. However, this is prevented by the quotation marks. For example:
This code works fine:
for %k %j 1 20 2 30 3 40
series country{%k}={%j}
next
But I would like to have the names of the countries as string variables
alpha country1="belgium”
alpha country2="germany”
alpha country3="italy”
This code does not work:
for %k %j 1 belgium 2 germany 3 italy
alpha country{%k}="{%j}"
next
This code does not work either:
for %k %j 1 "belgium" 2 "germany" 3 "italy"
alpha country{%k}={%j}
next
And this code doesn't work either:
for %k %j 1 {"belgium"} 2 {"germany"} 3 {"italy"}
alpha country{%k}={%j}
next
Is there a solution that I am overlooking?
Thank you very much for your help!
Best regards,
Björn
I would like to create new alpha variables with the for loop. However, this is prevented by the quotation marks. For example:
This code works fine:
for %k %j 1 20 2 30 3 40
series country{%k}={%j}
next
But I would like to have the names of the countries as string variables
alpha country1="belgium”
alpha country2="germany”
alpha country3="italy”
This code does not work:
for %k %j 1 belgium 2 germany 3 italy
alpha country{%k}="{%j}"
next
This code does not work either:
for %k %j 1 "belgium" 2 "germany" 3 "italy"
alpha country{%k}={%j}
next
And this code doesn't work either:
for %k %j 1 {"belgium"} 2 {"germany"} 3 {"italy"}
alpha country{%k}={%j}
next
Is there a solution that I am overlooking?
Thank you very much for your help!
Best regards,
Björn