@Ronein wrote:
Hello
I have the following challenge.
Let's say that there is an input data set .
I want to check which numbers in last column are new in comparison to previous column(one column before last column).
I want to check which numbers in one column before last column are not existing in last column.
I think that in the program we need to check how many columns are in in input data set and then we can compare last column with one column before last.
For example:
In the following example if we compare last column with one column before last:
9,10,11 are new members
8,9 left
I want to create a new outcome data set with two columns: new and left
data tbl;
input x1801 x1802 x1803 x1804 x1805 x1806;
cards;
1 1 6 1 1 2
2 2 1 2 2 3
3 3 2 3 3 4
4 4 3 4 5 5
5 5 4 8 8 8
5 9 9 10
;
run;
Does this requirement have anything to do with a data source that you keep "adding columns" to a base data set?
If so fix the data model. You are making lots of assumptions of what "last column" might mean and there is difficult to be sure that the columns you compare are what you think they are if the columns keep changing.