title: SAS MACRO error: Nesting of %IF statements in open code is not supported. %IF ignored
body: <p>When I execute this code, it came up with an error: <em>Nesting of %IF statements in open code is not supported. %IF ignored.</em>
  The code is as follows:</p>
  
  <pre><code>%let Vis_Perform_Filter = VISYN^=:"Y";
  data cp_ref_patient_visits;
      length CP_VISIT_PERFORMED 8.;
      set cp_ref_patient_visits;
  
      /* Are all visit identifiers related to actual performed visits? */
      /* if select 'Yes' */
      %IF %superQ(Vis_Perform_Filter) eq %THEN %DO;
        CP_VISIT_PERFORMED = 1; /* 1 OR 0 */
      %END;
      /* if select 'No' then apply filter condition */
      %ELSE %IF %superQ(Vis_Perform_Filter) ne %THEN %DO;
        if &amp;Vis_Perform_Filter. then CP_VISIT_PERFORMED = 0;
        else CP_VISIT_PERFORMED = 1;
      %END;
  
      label CP_VISIT_ID = "Internal Visit Identifier"
            CP_VISIT_PERFORMED = "Visit Performed Flag";
  
      proc sort; by SUBJID CP_PATIENT CP_VISIT_ID;
  run;
  </code></pre>
  
  <p>And the Error is:</p>
  
  <pre><code>31 %ELSE %IF %superQ(Vis_Perform_Filter) ne %THEN %DO;
  ERROR: Nesting of %IF statements in open code is not supported. %IF ignored.
  ERROR: Skipping to next %END statement.
  </code></pre>
  
  <p>I want to know why this error happens? How to solve this error?
  Thank you for your help~</p>