This may sound like a stupid question, but is it possilbe to create a string object e..g string _X (which works) and update the string within the program in a for loop rather than manually opening string and typing it in?
Thanks in advance
Sorry that was late at night, just realised that this question doesn#t make sense.
What I'm trying to do is to create a string object and update that string object within a program. I would want to use it in a loop.
1) For example, look at the following working simple part of the code
run program Y _X 4
pogram is an external program producing correlation matrixes for regression analysis. The way it is programmed, the first argument is the dependent variable Y, the second one
has to be a string object which is listing the explanatory variables and the third and last argument is the number of lags (in this case 4).
The Program runs beautifully, but I now want to run it en masse, ie
2) for a lot of variables. This is how I set it up:
' _countries is a string object containing 3 letter country codes, ie. the loop should rund over these countries
for %ccode {_countries}
run pogram D_{%ccode} _X 4
next
Obviously this only runs the loop over the dependent variable but the explanatory variable within the string object _X is restricted to its predefinition. The obvious solution would be (given that the structure of the explanatory variables is always I_*_{%ccode} where {%ccode} is the three letter country code) the following
for %ccode {_countries}
for %x I_*_{%ccode}
run pogram D_{%ccode} {%x} 4
next
next
or simply
for %ccode {_countries}
run pogram D_{%ccode} I_*_{%ccode} 4
next
The Problem I have is that the program running the correlation matrixes requries the second argument to be a
string object. Hence two things I thought of where
1) write a loop to creates string objects for every country ie. let there be string _X_??? with ??? being the three letter country code and the string contains the variable names. HOwever, I was not able to create a string object with the command string _X and update that string within that loop.
So my question is, is that even possible or do I have to manually update string objects via creating that object and typing it in.
2) from my understanding a string object simply is a list of series names wich when put into a loop will run this loop with the list of series successively. My problem is that the list of variables is the same only with a different ??? at the end for the country code specification. I could now go and manully create strings for every country e.g. _X_USA which will contain x1_USA x2_USA x3_USA....as variables/ seriesnames. But this is inefficient, especially when you want to add variables later to each regression per country ie that will require to go into each country specific string object and change it.
how can I thus create string objects in a loop while using the string {%ccode} that will create country specfic explanatory variables with the structure I_*_{%ccode} ?
Thanks in advance