...
Output.Write("<table border='1' cellspacing='0' cellpadding='5'>");
Output.Write("<tr><th>Encounter Date</th> <th>Encounter Name</th><th> <th>Variable 1</th> <th>Variable 2</th> </tr>");
// Loop through the encounters and output the encounter date and encounter name
// Each time through will create a row in the table with the next encounter
...