Hello all, In my data set there are a variety of hospital reporting data, each item of data has an affiliated date. I am working to normalize the data as I am using it to track progress towards a goal, but each hospital started at different times. Right now my code is cumbersome, and I know it is not ideal, but can't quite figure out how to fix it. What I ultimately want is a numeric variable (Month_Enroll) that provides the number of months before or after the start date that a case is from. For example, if a hospital started in June 2018, I would want all cases from May 2018 to have a Month_Enroll of -1 and all cases from July 2017 to have a Month_Enroll of 1. This data set is constantly be updated, so I am trying to write a program that will require minimum maintenance. I feel like I should be able to accomplish what I need with a DO Loop, but haven't been successful so far. This is what I have (it isn't working how I want). Delivery date = date a baby was born, record_id is affiliated with a hospital DATA Set.Clean; FORMAT delivery_date YYMMN6.; FORMAT Hospital_Start YYMMN6.; SET Set.Old; Hospital_Start = 06/01/2018; IF FIND(record_id, "56073") THEN DO; Month_Enroll = delivery_date - Luth_Start; END; RUN; I appreciate any help!
... View more