```Date: Wed, 30 Jul 2008 09:01:08 -0500 Reply-To: Mary Sender: "SAS(r) Discussion" From: Mary Subject: Re: missing value problem with merged variable Comments: To: E Joas Content-Type: text/plain; charset="iso-8859-1" I would use an else if; if you have any ones then it is a one, if you have all missings then it is a missing, otherwise (all zeros or a mixture of zeros and missing), then it is a 0. if y1=1 or y2=1 or y3=1 or y4=1 or y5=1 or y6=1 then blodbeh=1; else if y1=. and y2=. and y3=. and y4=. and y5=. and y6=. then blodbeh=.; else blodbeh=0; -Mary ----- Original Message ----- From: E Joas To: SAS-L@LISTSERV.UGA.EDU Sent: Wednesday, July 30, 2008 6:06 AM Subject: missing value problem with merged variable Hello everyone, I am working with a large epidemiological study and I am trying to create a variable that is dichotomous and tells if they have recieved treatment during any of these six visits. if y1=1 or y2=1 or y3=1 or y4=1 or y5=1 or y6=1 then blodbeh=1; if y1=0 and y2=0 and y3=0 and y4=0 and y5=0 and y6=0 then blodbeh=0; if y1=. and y2=. and y3=. and y4=. and y5=. and y6=. then blodbeh=.; The first line works perfectly as the outcome is a 1 if they have answered 1 on any of the questions, regardeless of missing values. The problem is with the second line as it produces a missing value if the respondent has a missing value response on any of the variables and I want a 0 based on the fact all of the observed variables are 0. Missing values should only be produced if they have a missing values on all the variable as the third line states. How can this problem be solved? Thanks for all the help Erik Joas ```

Back to: Top of message | Previous page | Main SAS-L page