Hi everyone, I'm having difficult building a solution to a problem I'm working on where I assign a value to a recipient based on multiple conditions. This can be done in a data step or SQL. Scenario: I'm working with a dataset that Has an ID variable, a claimtype (e.g., emergency, outpatient), the type of provider the person saw - and the important variable - was the provider they saw the one that was assigned to them. In all instances, the recipients is going to have an ED encounter, and I need to keep this variable. What i want to do is group recipients into three groups (A) always saw assigned provider, (B) sometimes saw assigned provider, and (C) never saw assigned provider. Ultimately these new variables will be my grouping variables to run some frequency statistics on (with dependent variable being ED visit) . I've created a Want and Have dataset below. Any help on this is appreciated. I'm not too worried about the blanks that I have in the Want table as I plan to just populate the empty spaces using a Retain function, but if you know of an easier way to flag a recipient, by ID, into one of the 3 groups then that's also great! thank you for your help, Nate data Have; input ID $ Claim $ provtype $ assigned &; datalines ; 1 ED EM . 1 OP SPEC . 1 OP SPEC . 1 OP MD 1 1 OP MD 0 2 ED EM . 2 OP MD 1 2 OP MD 1 3 ED EM . 3 OP SPEC . 3 OP MD 1 3 OP MD 1 3 OP MD 1 3 OP MD 1 3 OP MD 1 4 ED EM . 4 OP MD 0 4 OP SPEC . 4 OP MD 0 ; ; run ; data want; input ID $ Claim $ provtype $ assigned & both $ always $ never $; datalines ; 1 ED EM . . . . 1 OP SPEC . . . . 1 OP SPEC . . . . 1 OP MD 1 1 . . 1 OP MD 0 1 . . 2 ED EM . . . . 2 OP MD 1 . 1 . 2 OP MD 1 . 1 . 3 ED EM . . . . 3 OP SPEC . . . . 3 OP MD 1 1 . . 3 OP MD 1 1 . . 3 OP MD 1 1 . . 3 OP MD 1 1 . . 3 OP MD 1 1 . . 4 ED EM . . . . 4 OP MD 0 . . 1 4 OP SPEC . . . . 4 OP MD 0 . . 1 ;
... View more