Hi, im really new to SAS and i have to develope something that is crushing me hard.
I have a Dataset that looks like this:
id amount paytype expire_date
001 -15,2 1 17/12/2008
001 -30,1 1 .
001 30,1 2 15/03/2019
001 -8,3 1 .
001 8,3 2 13/02/2020
002 -8,3 1 .
002 -7,3 1 15/12/2019
Other things:
The paytype 1 is always a negative amount value, paytype 2 is always positive.
Some of the expire_date values of the paytype 1 are missing
Wath i need to do:
I need to give to those missing values the value of a paytype 2 with same absolute amount and id.
But here comes the trick
A paytype 2 can only be used to copy its expire_date value only once.
So in this case
001 -15,2 1 17/12/2008
001 -30,1 1 .
001 30,1 2 15/03/2019
001 -30,1 1 .
001 30,1 2 13/02/2020
I need to give to the first missing value the value of the first paytype 2 and to the second missing value the second paytype 2 value.
Im totally blind and pretty new to SAS so any help wold be greatly appreciated. Thank you.
Please provide the data as a program (data step or sql inserts).
Also please provide the desired output.
Is the value you might want to use to replace the missing value always located just after the missing value?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.