Hi David,
> I had provided a rather detailed answer yesterday which seems to have
> gone off into Statalist limbo as I don't see it in the Archive. One
> of my suggestions to address the need to have both bestand and zk
> defined would be as follows:
>
> local fnames parsed_cfd.txt parsed_qds.txt parsed_vfd.txt
> parsed_tsa.txt
> local sub cfd qds vfd tsa
>
> forvalues x=1/4 {
> clear
> /* Inlezen */
> local bestand :word `x' of `fnames'
> local zk :word `x' of `sub'
> insheet a b c d e using `"`bestand'"', tab
> /* other commands */
> }
>
> The loop simply scrolls through the values of the parallel lists.
> From your comments above, although the zk appears as a substring of
> bestand in the example, it may not always be so.
Thank you, that is a very nice suggestion. I will implement it.
> As a programming tip - you don't need the = sign to assign a string to
> a local macro, in fact, it limits the length of the string you can
> assign. A string expression can have only 244 characters (-local
> bestand = "..."- is a string expression) versus a string macro limit
> of 67,784 characters (1,081,511 in SE and MP). In your example there
> should be no problem, but if you were to assign a long macrolist to a
> macro, you might get bitten.
Ok, thanks for the warning. I will remember it.
> Also, if you don't want all the output generated by a -set trace on-
> for debugging you can surround just the suspect statements.
> Alternatively, if you want to check that a macro assignment went as
> intended, dropping in a -macro dir- is helpful.
Thanks, will keep that in mind!
> As for the discussion above - I agree with Hendri that it is often
> valuable to discuss the debugging process, error messages and their
> limits, and the processes one must go through in order to diagnose and
> correct one's error(s). We can all learn from these discussions.
I agree. Thanks again David for so many helpful suggestions!
Best regards,
-Hendri.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/