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
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.
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.
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
Ok, but I still miss the business requirement, and how do you define the rule which values you need to concatenate?
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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.