title: How to split excel data by region and mail fractions to appropriate addresses from SAS?
body: <p>I have prepared a dataset in sas and exported in the .xlsx format to a location on my computer. I'm able to send mail with the attachment which i have exported. I wanted to know if there's a possibility to apply a 'where' condition to a column(Region in this case,having 4 values -W,E,S,N) in the excel via sas programming and attach the filtered (specific records , like data for W,S only etc) excel file to an appropriate email address? Kindly help.I'm attaching the code written on SAS Enterprise Guide 7.1 for single recipient which sends the unfiltered excel and the image of the sample data. <a href="https://i.stack.imgur.com/RSHec.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RSHec.jpg" alt="enter image description here"></a></p>
  
  <pre><code>options emailsys = smtp
      emailid = 'xxxx@gmail.com'
      emailpw = 'xxxx'
      emailhost = 'smtp.gmail.com'
      emailport = 587 ;
  
  options emailhost=(
      'smtp.gmail.com'
      STARTTLS auth=LOGIN
      id='xxxx@gmail.com'
      pw='xxxx' port=587
  );
  filename f_email email
      to = 'xxxx@jkl.com'
      from = 'xxxx@gmail.com'
      subject = 'Test'
      attach=("D:\abc\xxxx.xlsx"  content_type="application/xlsx");
  
  data _null_;
      file f_email;
      put 'Test';
  run;
  </code></pre>
  
  <p>Regards,
  sklal</p>