Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: For loop with wildcards for string suffixes

From   "Rachel S" <[email protected]>
To   statalist <[email protected]>
Subject   st: For loop with wildcards for string suffixes
Date   Thu, 21 Sep 2006 10:05:31 -0400

I'm trying to figure out the syntax for generating interaction
variables using wildcards for suffixes.

I have variables PhoneAA PhoneBB PhoneCC Phone DD and PreferenceAA
PreferenceBB PreferenceCC and Preference DD.

I'd like to generate the interaction variable that would occur from a
product of these two vectors:
PhonePrefAA=PreferenceAA*PhoneAA, PhonePrefBB=PreferenceBB*PhoneBB, etc.

The problem is that I have many of these types of variables and six
suffixes, and I don't want to type out all the suffixes individually.
Is there a way I can do this using a for loop?

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index