BookmarkSubscribeRSS Feed
mmea
Quartz | Level 8

Hi

I have this proc compare, where I compare two sets for differences:

proc compare 
 base = Set1
 compare = set2
	out= diff outdiff; 
run;

The out dataset diff - contains 4 variables: Type of observation = DIFF, observation number = 1, variable1 = 0, variable2 = 0.

 

I need a if statment that says: If variable1 and variable 2 = 0, in other words there is no difference, then do the next line of code.

 

I know the set up will be something like that, but how can I specify the two variables from DIFF?

 

%if  ??? and   ???  %then %do ; 

**put code here;

%end;
3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

Try this

 

data want;
   set diff;
   if variable1 = 0 and variable2 = 0 then do;
      /* Your Statement Here */
   end;
run;
mmea
Quartz | Level 8

Does this work if my code is a proc sql? 🙂

mmea
Quartz | Level 8

also I have and else do after the do statment 🙂

 

So the statment should DO the proc sql code when variables = 0 else 

send out an email code