title: Assigning data from SAS data set to variable (SAS E Guide 5.1)
body: <p>I use SAS to execute queries, and sometimes send an email to my team afterward to confirm that the query has executed. However, I never really know if it was successful unless I check manually. </p>
  
  <p>For example, I have a SAS job that executes a stored procedure which appends a table with more data from today. I want to be able to add the MAX(date) from that table to email text, or a COUNT(*) where the date is today to the email, so I can know how many records were added.</p>
  
  <p>Here is what I would imagine it would look like:</p>
  
  <pre><code>PROC SQL;
      CREATE TABLE sasData AS
      SELECT 
          COUNT(*) AS myRecordCount
      FROM
          tableName
  ;QUIT;
  
  %LET newVariable = sasData.myRecordCount;
  </code></pre>
  
  <p>So, I know the above isn't how it works, but it's the idea.</p>
  
  <p>Can anyone show me how to do this properly? Thanks!</p>