Skip connection in 2 roster

Discussions about CSEntry
Post Reply
Socio
Posts: 48
Joined: May 1st, 2017, 4:47 am

Skip connection in 2 roster

Post by Socio »

I have 2 roster
Roster 1 (with 9 occurrence)
Q1 Q2

Roster 2 (with 9 occurrence)
Q3 Q4 Q5

I want to skip complete row (same row with Q2) in roster 2 if Q2 = 2
Thank you.

I have attached a file of the form
Attachments
Roster 1 and 2.docx
(12.27 KiB) Downloaded 341 times
josh
Posts: 2401
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Skip connection in 2 roster

Post by josh »

You can use to "skip to next" to skip an entire row in a roster. So to skip the entire row if Q2 = 2 you would do something like:
PROC Q3
preproc
if Q2 = 2 then
    
skip to next;
endif;
Socio
Posts: 48
Joined: May 1st, 2017, 4:47 am

Re: Skip connection in 2 roster

Post by Socio »

Dear Josh

Thank you for this. When I write the code it shows error message to add subscript, so I add like this

Code: Select all

PROC Q3
preproc
if Q2 (1/9) = 2 then
    skip to next;
endif;
Unfortunately its not working. Please help me.
josh
Posts: 2401
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Skip connection in 2 roster

Post by josh »

Sorry, yes you need a subscript here. Since you are in the second roster, CSPro doesn't know which row number to use when referring to a variable in the first roster. See here for more info subscripts (http://www.csprousers.org/help/CSPro/subscripts.html). In this case you can use curocc() (http://www.csprousers.org/help/CSPro/cu ... ction.html) for the subscript. That will use the row number from the second roster as the subscript for the first roster i.e. you will use the variable in the corresponding row.
PROC Q3
preproc
if Q2(curocc()) = 2 then
    
skip to next;
endif;
Socio
Posts: 48
Joined: May 1st, 2017, 4:47 am

Re: Skip connection in 2 roster

Post by Socio »

Thank you, Josh
The given code is working.
PROC Q3
preproc
if Q2(curocc()) = 2 then
    
skip to next;
endif;
Post Reply