10-20-2016 03:28 PM
You're better off converting that to a logic requirement and then someone can help implement the code in SAS. One to one conversion is rarely a good idea, there's possibly a totally different way of implementing this in SAS.
It looks like you're incrementing based on some sort of logic by checking if the records are the same?
Sample input and output data are also very helpful, character vs numeric variables can affect how the solution is implemented.
10-20-2016 04:09 PM
Here is my data set. The Admit_ID is the variable I need to create.
The attachment looks like it didn't make it.
In case you attempted a an Excel file many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.
You can follow instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... to turn you SAS data set into data step code that can be posted directly to the forum or attach as a text file.
10-20-2016 03:37 PM
Do you have a SAS data set? Post a few rows of example input data from the SAS data set and the desired output.
Note that the the function in SAS to look at the value of a variable in a previous row is LAG.