SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Di Studio - Previous Row

Accepted Solution Solved
Reply
Contributor
Posts: 58
Accepted Solution

Di Studio - Previous Row

Is possible, using only transformations in DI Studio (without using programming), get the previous record of a data set and implement the logic below?

Input:

1 a

1 b

1 c

2 d

3 e

3 f

Output:

I need to calculate a new column that uses the value from the previous record.

1 a   a

1 b   a-b

1 c   a-b-c

2 d   d

3 e   e

3 f   e-f


Accepted Solutions
Solution
‎12-31-2013 02:36 PM
Contributor
Posts: 58

Re: Di Studio - Previous Row

Posted in reply to DavidCaliman

I found the answer to this problem on the link below.

I added code in the user written code transformation and it worked.

Thank you.

https://communities.sas.com/message/53141

View solution in original post


All Replies
Super User
Posts: 5,431

Re: Di Studio - Previous Row

Posted in reply to DavidCaliman

From your sample (which seems  abit inconsistent), I would say no.

If this is a common task, you could package your logic in a  User Written Transformation so it could be reused.

But can I question the purpose for this logic? From the little information you give, the calculation doesn't look like anything that needs to be stored in a Data Warehouse process, rather a customized report. Please tell us more about the business requirement for this calculation.

Data never sleeps
Contributor
Posts: 58

Re: Di Studio - Previous Row

I need the following final result:

Input:

cd dsc

1 a

1 b

1 c

2 d

3 e

3 f

Output:

I need to group by code and do a concatenation descriptions.

cd concat

1 a-b-c

2 d

3 e-f

Super User
Posts: 5,431

Re: Di Studio - Previous Row

Posted in reply to DavidCaliman

Ok, but I still miss the business requirement, and how do you define the rule which values you need to concatenate?

Data never sleeps
Solution
‎12-31-2013 02:36 PM
Contributor
Posts: 58

Re: Di Studio - Previous Row

Posted in reply to DavidCaliman

I found the answer to this problem on the link below.

I added code in the user written code transformation and it worked.

Thank you.

https://communities.sas.com/message/53141

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 382 views
  • 0 likes
  • 2 in conversation