03-20-2014 09:47 PM
I'm working on a case control study and the cases and controls are identified using a letter at the end of the identification number. Some cases are matched 1:1 with controls and some are matched 1:2, or 1:3. A case/control pair may be identified as follows: GI111A, GI111B, GI111X with A and B denoting control status and X denoting case status. I want to perform analyses comparing cases and controls and therefore want to make a new variable "case status" defined by the ending letter. Is there a procedure I can use to scan the identification numbers and then identify cases and control, respectively? I haven't tried any code yet, I was just wondering if there was a quick and easy way to do this?
03-20-2014 10:15 PM
You could use:
case = char(id,length(id)) = "X";
in a datastep, where id is your identifier. The value of case will be 1 for cases and 0 for controls.