I need a code to classify the column readmit (in this example) into two groups based upon hospital ID? Admission ID denotes individual pt. The first admission is an index and subsequent admission is readmit. I want to form two subgroups where readmitted patients went to the same hospital. So if hospital ID is the same for index and readmits I want to classify them in one group while if they were readmitted to a different hospital, they will belong to another group. In this example hospital IDs for patients in rows, 2 and 3 are different so they should be classified in one group while rows 8 and 9 have the same hosp ID and will belong to another group. I want to create a separate column with groups A, B, and 0. A- same facility, B different and C none. Index admissions should be assigned o. The excel file is just for the sample. I will supply you a dat file to check the code which is 10% of the main file (26GB). Thanks