Hello, The new code you provided worked perfectly this time. I'll try to explain my main goal better and maybe you will be able to guide me on how to do that. In the main dataset, all of the variables are attached to a unique patient ID. Each patient was seen at a particular facility, indicated by their facility ID. I wanted to get the frequency of patients seen at each facility (the counts) to get a measure for the facility volume. Now I need to take that facility volume and make it a new variable in the main dataset, but linked to the unique patient ID. This way I'll be able to conduct a survival analysis based on facility volume. There are some 48,000 patients in the dataset and about 1,200 facilities. When I merged the data over, by facility ID, it just had 1,200 observations. I need to new Facility_Volume variable to have 48,000 observations, for each of the patients based on the volume of their Facility_ID. Is there a way to bring the patient ID over with the new data output when creating the Facility_Volume variable? That way I can merge it back by patient ID? Thanks for your help with this! We are almost to what I need to do. I really appreciate it. no attachments. -##
... View more