Appending the "SPSS Name" property problemHello,
I'm trying to append the "SPSS Name" property for all columns in my dataset with the string "_R1". This loop works until line 5; the result is that all the SPSS Names get changed to SNname - not the value of the variable, but the text SNname. I've tried putting it in quotes and I've tried using the Name() function and it still didn't work. I'm hoping someone can tell me the syntax I need to use to get this to work. I've attached an abbrievieted file of my data. Thanks!
For( i = 1, i <= N Cols( dt ), i++,
cName = Column(dt,i) << Get Property("SPSS Name");
SNname = cName|| "_R1";
show(SNname);
<FONT color="#FF0000">Column( dt, i ) << Set Property("SPSS Name", SNname );</FONT>
);Re: Appending the "SPSS Name" property problemThis is more elegant. Nice add Jim.
Re: Appending the "SPSS Name" property problemYou need to perform an eval() on the variable SName.
For( i = 1, i <= N Cols( dt ), i++,
cName = Column(dt,i) << Get Property("SPSS Name");
SNname = cName|| "_R1";
show(SNname);
Column( dt, i ) << Set Property("SPSS Name", eval(SNname) );
);Re: Appending the "SPSS Name" property problemSet Property() is not going to evaluate SName. You probably need to parse SName before evaluating that line. Try this:
Eval(Parse(Eval Insert("\[Column( dt, i ) << Set Property("SPSS Name", ^SNname^ )]\")));