Patti,

Here's a simplified snippet that has R:BASE create a SET VAR command and
execute it:

-- presuming you have one variable, vVarName, that holds a variable name,
and another, vVarValue, that holds an integer value looked up in a table:

SET VAR vCommand = ('SET VAR' & .vVarName & 'INTEGER =' & ctxt(.vVarValue))
&vCommand

vCommand has a value that looks like:
SET VAR MyVar INTEGER = 1

The "&" form of a variable reference tells R:BASE to just substitute the
whole thing as a command or part of a command, rather than trying to
evaluate it.

If you actually store Y and N, then it is a text variable:

SET VAR vCommand = ('SET VAR' & .vVarName & 'TEXT =' & '''' + .vVarValue +
'''')
&vCommand

vCommand looks like:
SET VAR myVar TEXT = 'Y'

In the SET VAR command that creates the SET VAR command, to put the
quotation marks in you have to double the quote mark to "escape" it, and
then surround the escaped quote mark with quote marks, so it takes four in a
row to make a single quote in the resulting variable.

Bill

On Tue, Jun 7, 2011 at 2:22 PM, Patti Jakusz <[email protected]> wrote:

> Hi Bill,
> I'll have to get my code into a more readable form before posting it.  (I
> may not get a chance again until tomorrow.)
>
> I thought about doing the "narrow" table as you suggested (kind of a cross
> between your two methods), but I will have to build a "wide" table anyway,
> for sending data to other health depts.  I was hoping to only have the wide
> one - but maybe it will be easier to have it both ways.
> Patti
>

Reply via email to