title: Union issue in SAS
body: <p>I have met an issue about union in SAS.</p>
  
  <p>1) When I run the code below:</p>
  
  <pre><code>proc sql;
  select count(*) as cnt_obs, count(distinct user) as cnt_user from input1
  union all
  select count(*) as cnt_obs, count(distinct user) as cnt_user from input2
  union all
  select count(*) as cnt_obs, count(distinct user) as cnt_user from input3
  union all
  select count(*) as cnt_obs, count(distinct user) as cnt_user from input4
  quit;
  </code></pre>
  
  <p>I got the result:</p>
  
  <pre><code>cnt_obs    cnt_user
  10000000   4983437
  9771110    4983438
  8345177    4983438
  8188069    4983438
  </code></pre>
  
  <p>2) But according to my process prior to this proc sql step, the second column of the result should be the same, so I run another code to check my result. When I run the code below:</p>
  
  <pre><code>proc sql;
  select count(*) as cnt_obs, count(distinct user) as cnt_user from input1;
  select count(*) as cnt_obs, count(distinct user) as cnt_user from input2;
  select count(*) as cnt_obs, count(distinct user) as cnt_user from input3;
  select count(*) as cnt_obs, count(distinct user) as cnt_user from input4;
  quit;
  </code></pre>
  
  <p>I got the expected result:</p>
  
  <pre><code>cnt_obs    cnt_user
  10000000   4983437
  9771110    4983437
  8345177    4983437
  8188069    4983437
  </code></pre>
  
  <p>3) It seems there's an issue with UNION in SAS proc sql step, does anyone know what the problem is? Thanks very much!</p>