Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

SAS Visual analytics get the previous value and IF THEN ELSE Statement By Group

Reply
Contributor
Posts: 62

SAS Visual analytics get the previous value and IF THEN ELSE Statement By Group

[ Edited ]

Hi experts,

 

i need to handle an if statement based on a variable.

 

I have Cust and Source and i want PrevSource.

The PrevSource column shows the value of Source of the previous row, which is a lag func in base sas with an if statement than if first.cust then prevSource=Source.

Is it possible in VA to do this?

 

CustSourcePrevSource
1AA
1AA
1BA
2AA
2AA
3AA
4BB
4AB
4BA

 

 

 

I want this data 

CustSourcePrevSourceIf_stat
1AA0
1AA0
1BA1
2AA0
2AA0
3AA0
4BB0
4AB0
4BA1

 

where the IF_STAT column is 1 IF source =B and PrevSource <> B for the same Cust, else 0.

 

I can't to do this before VA because this IF STAT must change in base of the chosen filter.

 

Thank you

 

 

Ask a Question
Discussion stats
  • 0 replies
  • 55 views
  • 0 likes
  • 1 in conversation