Can you help me figure out this error for this code? Does count work with
vectors and temporary variables? "On the COUNT command, the count variable was not followed by the required equals sign." LOOP #cnt=1 to 5 BY 1. COUNT VectorBLK_A(#cnt)=MasterVectorBlock(#cnt) (1). COUNT VectorBLK_B(#cnt) = MasterVectorBlock(#cnt) (2). COUNT VectorBLK_C(#cnt) = MasterVectorBlock(#cnt) (3). COUNT VectorBLK_D(#cnt) = MasterVectorBlock(#cnt) (4). END LOOP. EXECUTE. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
I am utterly confused by what it is that you want to do. Apparently MasterVectorBlock, call it MVB, is a vector of length 5, each element of which may have values ranging from 1 to 4. VBA thru VBD are also of length 5. VBA(1)=1 if MVB(1) equals 1; otherwise, 0. So you go from 5 variables to 20 variables. The 5 are 1-4 range and the 20 are 0,1 range. Is this what you are wanting to do?
A non-compact way would be to write a do if-end if block for each MVB variable. Without trying out some code, I think that you could do this with a set of if statements inside the loop-end loop. Another way, I think, would be with a do repeat. Gene Maguin -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Xyb Pontra Sent: Sunday, June 15, 2014 6:44 PM To: [hidden email] Subject: Using vectors in COUNT Can you help me figure out this error for this code? Does count work with vectors and temporary variables? "On the COUNT command, the count variable was not followed by the required equals sign." LOOP #cnt=1 to 5 BY 1. COUNT VectorBLK_A(#cnt)=MasterVectorBlock(#cnt) (1). COUNT VectorBLK_B(#cnt) = MasterVectorBlock(#cnt) (2). COUNT VectorBLK_C(#cnt) = MasterVectorBlock(#cnt) (3). COUNT VectorBLK_D(#cnt) = MasterVectorBlock(#cnt) (4). END LOOP. EXECUTE. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Administrator
|
In reply to this post by SP
Nope!
You would do well to provide a concise description of what you are trying to accomplish! Inputs and desired outputs perhaps along with a data snippet!
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Administrator
|
In reply to this post by Maguin, Eugene
I'm confused as to why COUNT is being applied to a single variable! This code is bramaged!
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Administrator
|
In reply to this post by Maguin, Eugene
Not sure WHY you want to do this, but assuming Gene's ESPss is on target; does this do what you require?
/*<data sim> */. MATRIX. SAVE TRUNC(UNIFORM(100,5)*4+1)/OUTFILE * / VARIABLES MVB1 TO MVB5. END MATRIX. /*</data sim> */. NUMERIC VA1 TO VA5 VB1 TO VB5 VC1 TO VC5 VD1 TO VD5 (F1.0). RECODE VA1 TO VD5 (ELSE=0). VECTOR MVB=MVB1 TO MVB5 /VATOD=VA1 TO VD5. LOOP #cnt=1 to 5 . COMPUTE VATOD((MVB(#cnt)-1)*5+#cnt)=1. END LOOP.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Free forum by Nabble | Edit this page |