09-04-2014 05:16 PM
I have a questions regarding PROC SQL and missing information. I am trying to add two variables together, divide them by a third variable, to create a completely new variable. One of the variables I am adding by is missing. This causes the final variable to be missing as well, even though the other variables have values. Is there a way around this? Here is my code:
create table finaltable2 as
select site label='Site Number'
,total_subject label='Number of Subjects'
,SECs label='Number of SECs'
,DCFs label='Number of DCFs'
,((SECs + DCFs)/total_subject) as avgquery label='Avg SEC/DCF per Subject' format=6.2
The bold line of code is the one I am having trouble with. the value of SECs is missing, but DCFs and total_subject are not. SAS is stilling outputting avgquery as missing.
Any help would be greatly appreciated.
09-04-2014 05:34 PM
But beware, if both SECs and DCFs are missing, SUM will yield a missing value.
Use SUM(SECs, DCFs, 0) to avoid that.
Message was edited by: PG
09-05-2014 02:58 AM
/*Prepare some data*/
if _N_=1 then height=.;
(weight + case
when . then 0
Need further help from the community? Please ask a new question.