<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8311228539257764898</id><updated>2024-08-28T18:37:11.373+05:30</updated><title type='text'>SAS: The Power To Know</title><subtitle type='html'>SAS helps organizations anticipate business opportunities, empower action and drive impact. We do this through advanced analytics that turn data about customers, performance, financials and more into meaningful information. The result? Fact-based decisions for undeniable bottom line impact – this is how we transform the way our customers do business. </subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>23</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-1813129768648170245</id><published>2016-06-18T19:40:00.002+05:30</published><updated>2016-06-18T19:51:50.677+05:30</updated><title type='text'>PROC SPELL: The Spell of SAS PART -2</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Continuing to PROC SPELL: The Spell of SAS PART -1, this is part 2 for making proc spell more comfortable.&lt;br /&gt;
Lets take some example to understand how proc spell works.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15.4px; line-height: 21.56px;&quot;&gt;First create a misspelled file :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Industries understand special traininng needs&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Industry understand special training needs&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Industrys understund special traininng needs&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;industri understand spesial training needs&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;indastry usderstand special training needs&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;industre undarstund special trainng needs&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;You should not trast anyone blindly&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Now import this SAS file in a SAS system:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;%let location = M:\sasfolder\SAS files;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;libname data &quot;&amp;amp;location.&quot;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;filename sample &quot;&amp;amp;location.\misspelled file.txt&quot;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Now to create a catalogue of words in the file&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Proc SPELL words = sample&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Create dict = data.mycatgalog.Spell;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Run;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;&amp;nbsp;Now initiate a file for accommodating required output :&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Proc Printto print = &quot;&amp;amp;location.\output.txt&quot; new;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Run;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;/* &amp;nbsp;Now with the help of Proc Spell, we try to identify the misspelled words and seek suggestion to correct those, and take output in the above initialized file &amp;nbsp;*/&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Proc Spell in = sample&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;dictionary = data.mycatgalog.Spell&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;verify suggest;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;run;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Proc Printto print = print; Run;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiLKwR51iP6_dXCrNMuvHvQk0YckmOO_KRnWOINiYkvjTEgENv7z-uRfN96aCp9sN0btc45Osxs5E56DXXsAvqmgSTuvirQpPj1bK_Roelw7MoyOis_DHep9et5ilQjvJzY4Yi8rb7UsE/s1600/gem_2_3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;background-color: white; clear: right; color: blue; float: right; font-family: &amp;quot;Trebuchet MS&amp;quot;, Trebuchet, Verdana, sans-serif; font-size: 15.4px; line-height: 21.56px; margin-bottom: 1em; margin-left: 1em; text-decoration: none;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiLKwR51iP6_dXCrNMuvHvQk0YckmOO_KRnWOINiYkvjTEgENv7z-uRfN96aCp9sN0btc45Osxs5E56DXXsAvqmgSTuvirQpPj1bK_Roelw7MoyOis_DHep9et5ilQjvJzY4Yi8rb7UsE/s1600/gem_2_3.jpg&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;&quot; /&gt;&lt;/a&gt;&lt;b style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;/* &amp;nbsp;Open the output file to understand the output of Proc Spell, let&#39;s get the output back into SAS */&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Data data.List_correction;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;infile &quot;&amp;amp;location.\output.txt&quot; missover firstobs = 7 ;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;input A &amp;amp; $1000. ;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Run;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;b&gt;/* &amp;nbsp;Transform the output file into readily usable form */&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Data data.List_correction;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;set data.List_correction;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;retain id 1;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;if A = &quot;&quot; then id +1;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Run;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Proc transpose data = &amp;nbsp;data.List_correction out = data.transposed;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;by id;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;var A;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;where A ~=&quot;&quot;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;Trebuchet MS&amp;quot;, Trebuchet, Verdana, sans-serif; font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Run;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 15.4px; line-height: 21.56px;&quot;&gt;data data.transposed;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 15.4px; line-height: 21.56px;&quot;&gt;length suggested $1000.;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 15.4px; line-height: 21.56px;&quot;&gt;retain id original_word &amp;nbsp;suggested;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 15.4px; line-height: 21.56px;&quot;&gt;set data.transposed (drop = _name_);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 15.4px; line-height: 21.56px;&quot;&gt;rename Col1 = original_word;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 15.4px; line-height: 21.56px;&quot;&gt;suggested = scan(Col2,2,&quot;:&quot;); drop col2; run;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy8WiSTj9VuNyXxG8hXqfp3I3NiS8SUnhUDsyc6Q8caRpkdWfMV3a1H498TSLZZE2Z4dFE8mXhYEa92AesGE6yzg7QAuVsdHGYuYmaMNpSGUrGVufxVHepcHHhz5h77QZyBKROnMdrOUU/s1600/gem_2_4.jpg&quot; imageanchor=&quot;1&quot; style=&quot;background-color: white; clear: right; color: blue; float: right; font-family: &amp;quot;Trebuchet MS&amp;quot;, Trebuchet, Verdana, sans-serif; font-size: 15.4px; line-height: 21.56px; margin-bottom: 1em; margin-left: 1em; text-decoration: none;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy8WiSTj9VuNyXxG8hXqfp3I3NiS8SUnhUDsyc6Q8caRpkdWfMV3a1H498TSLZZE2Z4dFE8mXhYEa92AesGE6yzg7QAuVsdHGYuYmaMNpSGUrGVufxVHepcHHhz5h77QZyBKROnMdrOUU/s1600/gem_2_4.jpg&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;Data data.transposed;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;retain id&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;original_word &amp;nbsp;suggested;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;set data.transposed;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;run;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;&amp;nbsp;... and here we are with a list of incorrect words with suggested correction. For few words, we might not get any and for others, we might get more than one, Now to it is time to build the further algorithm to replace wrong word with the most appropriate corrected word. You can build a macro and use tranwrd function to replace the word.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: trebuchet ms, trebuchet, verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15.4px; line-height: 21.56px;&quot;&gt;This page has taken reference from the link: &lt;a href=&quot;http://www.askanalytics.in/2016/06/spellbinding-proc-spell.html#more&quot; target=&quot;_blank&quot;&gt;SAS Gems&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: white; font-family: &amp;quot;Trebuchet MS&amp;quot;, Trebuchet, Verdana, sans-serif; font-size: 15.4px; line-height: 21.56px;&quot; /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;trebuchet ms&amp;quot; , &amp;quot;trebuchet&amp;quot; , &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15.4px; line-height: 21.56px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/1813129768648170245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2016/06/proc-spell-spell-of-sas-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/1813129768648170245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/1813129768648170245'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2016/06/proc-spell-spell-of-sas-part-2.html' title='PROC SPELL: The Spell of SAS PART -2'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiLKwR51iP6_dXCrNMuvHvQk0YckmOO_KRnWOINiYkvjTEgENv7z-uRfN96aCp9sN0btc45Osxs5E56DXXsAvqmgSTuvirQpPj1bK_Roelw7MoyOis_DHep9et5ilQjvJzY4Yi8rb7UsE/s72-c/gem_2_3.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-8598768499437414586</id><published>2016-06-18T19:26:00.003+05:30</published><updated>2016-06-18T19:26:53.382+05:30</updated><title type='text'>PROC SPELL: The Spell of SAS PART -1</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;Where spelt is a fileref for the file containing the text to be spell checked and words is a libref pointing to the SAS library where the spell checker list is located. The suggest option lists spelling suggestions from the dictionary.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;Verify is the default and is assumed unless a custom catalog is being created or updated with &lt;b&gt;Proc SPELL&lt;/b&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;To be more useful, a custom dictionary of industry relevant words that are not in SAS&#39; dictionary can be created. This dictionary is a SAS catalog entry and is created with the spell procedure. To create a dictionary:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;Create a text file with the upper case words that you want to define.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;Put each word on a separate line.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;Point to the SAS file that holds the dictionary catalog (if updating) or create a new catalog.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;Point to the location of the custom word list.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;filename Spelt &#39;&amp;lt;file-specification&amp;gt;&#39;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;PROC Spell in &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = Spelt&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dictionary = Words.spell.mywords&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; verify&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; suggest;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;run;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;//***********************************************&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;filename textdata &#39;c:\text.txt&#39;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;PROC Spell in = textdata&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;verify;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;run;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier; font-size: 12.8px; line-height: 16.64px;&quot;&gt;//***********************************************&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;The code below creates the custom word catalog. This newly created catalog includes those entries in the SAS catalog in addition to the added custom words. To add words to a custom catalog change create to update.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;PROC Spell words &amp;nbsp;= &quot;e:sasfolder\condition.txt&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;create&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dict = work.mycatalog.spell;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: monospace, Courier;&quot;&gt;&lt;span style=&quot;font-size: 12.8px; line-height: 16.64px;&quot;&gt;run;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
//*********************************************&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;/*** &amp;nbsp;Using Proc Spell, find all combination***/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;/*** &amp;nbsp; &amp;nbsp;of letters that compose a valid word composed &amp;nbsp;***/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;/*** &amp;nbsp; &amp;nbsp;of 3 or 4 letters from a phone number. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ***/&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;pre&gt;&lt;b&gt;%let myphone = 8 6 0 6 7 3 9 2 7 8; /*** 10 digit phone number ***/
 /*** with spaces between each number as delimiters ***/

 Data A (Keep = L) ;
   Array C (0:9, 4) $1. _Temporary_
                        (&#39; &#39;  &#39; &#39;  &#39; &#39;  &#39; &#39;
                         &#39; &#39;  &#39; &#39;  &#39; &#39;  &#39; &#39;
                         &#39;A&#39;  &#39;B&#39;  &#39;C&#39;  &#39; &#39;
                         &#39;D&#39;  &#39;E&#39;  &#39;F&#39;  &#39; &#39;
                         &#39;G&#39;  &#39;H&#39;  &#39;I&#39;  &#39; &#39;
                         &#39;J&#39;  &#39;K&#39;  &#39;L&#39;  &#39; &#39;
                         &#39;M&#39;  &#39;N&#39;  &#39;O&#39;  &#39; &#39;
                         &#39;P&#39;  &#39;Q&#39;  &#39;R&#39;  &#39;S&#39;
                         &#39;T&#39;  &#39;U&#39;  &#39;V&#39;  &#39; &#39;
                         &#39;W&#39;  &#39;X&#39;  &#39;Y&#39;  &#39;Z&#39;);

  /***                       0 1 2 3 4 5 6 7 8 9 ***/
  Array T (0:9) _Temporary_ (1 1 3 3 3 3 3 4 3 4) ;
  /***                       my    phone number  ***/
  Array P (0:9)  P0 - P9    (&amp;amp;myphone);
  Length L  $12. ;

  Do X0=1 To T(P0) ;  SubStr(L, 1,1) = C(P0,X0) ;
  Do X1=1 To T(P1) ;  SubStr(L, 2,1) = C(P1,X1) ;
  Do X2=1 To T(P2) ;  SubStr(L, 3,1) = C(P2,X2) ;
/*** create a space for position 4 ***/
  Do X3=1 To T(P3) ;  SubStr(L, 5,1) = C(P3,X3) ;
  Do X4=1 To T(P4) ;  SubStr(L, 6,1) = C(P4,X4) ;
  Do X5=1 To T(P5) ;  SubStr(L, 7,1) = C(P5,X5) ;
/*** create a space for position 8 ***/
  Do X6=1 To T(P6) ;  SubStr(L, 9,1) = C(P6,X6) ;
  Do X7=1 To T(P7) ;  SubStr(L,10,1) = C(P7,X7) ;
  Do X8=1 To T(P8) ;  SubStr(L,11,1) = C(P8,X8) ;
  Do X9=1 To T(P9) ;  SubStr(L,12,1) = C(P9,X9) ;
     Output ;
  End; End; End; End; End; End; End; End; End; End;
Run ;

 /*** create an external bad word file for PROC SPELL ***/
 data _null_;
 file &quot;testprocspell.txt&quot;;
 set a;
 put L;
 run;

 proc printto file=&quot;badwords.lis&quot; new; run;
 proc spell wordlist=&quot;testprocspell.txt&quot;; run;
 proc printto; run;

  /*** read bad words created by proc spell ***/
  data badwords;
   infile &#39;badwords.lis&#39;      missover ;
   input @1 badwords $ 30. ;
   if badwords = &#39; &#39; then delete;
   badwords = left(badwords);
   if 0 ne index(badwords, &#39;File:&#39;) then delete;
   if 0 ne index(badwords, &#39;Unrecognized&#39;) then delete;
  run;

  proc sort data=badwords out=badwords nodupkey; by badwords; run;

  /*** now create a badword cleanup file ***/
  data clnbadwd (drop=badwords);
   length target $ 50 replace $ 50;
   set badwords;
   target = badwords; replace = &#39; &#39;;
  run;

  /*** Using TIP 00128a (CLEANSEM.sas) ***/
  %include &#39;cleanse_my.sas&#39;; /*** my temporary version ***/

  /*** need to check each schema for cyclical mappings  ***/
  /*** as well as create a global macro variable to get ***/
  /*** number of records for each schema used           ***/
  /*** CHECK OUTPUT for any cyclical mapping reports    ***/

  %chkschem( schema=clnbadwd);

 data clean;
  set a;
        %cleanse(schema=clnbadwd ,var=L       );
  if L ne &#39; &#39;; /*** keep only non blank L ***/
 run;

 proc sort data=clean out=clean nodupkey; by L; run;

 /*** now create an output file of just valid words ***/
 data _null_;
  set work.clean;
  file &quot;cleanwords.txt&quot;;
  put L;
 run;

/*** output from Clean Words Recognized by PROC SPELL 
     default Dictionary                                 ***/
ORE
ORE PART
ORE PAST
ORE WART
PART
PAST
TO
TO    PART
TO    PAST
TO    WART
TO  ORE
TO  ORE PART
TO  ORE PAST
TO  ORE WART
WART

/*** end of program ***/&lt;/b&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;b&gt;
&lt;/b&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;b&gt;Reference for PROC Spell: &lt;a href=&quot;http://analytics.ncsu.edu/sesug/2007/SD06.pdf&quot;&gt;http://analytics.ncsu.edu/sesug/2007/SD06.pdf&lt;/a&gt;&lt;/b&gt;&lt;/pre&gt;
&lt;pre&gt;
&lt;/pre&gt;
&lt;pre&gt;&lt;b&gt;For Practice part , next part to be continued in next blog-&lt;/b&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/8598768499437414586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2016/06/proc-spell-spell-of-sas-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/8598768499437414586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/8598768499437414586'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2016/06/proc-spell-spell-of-sas-part-1.html' title='PROC SPELL: The Spell of SAS PART -1'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-7092864218138609469</id><published>2016-06-05T19:01:00.002+05:30</published><updated>2016-06-05T19:01:17.416+05:30</updated><title type='text'>BASE SAS : Interview Questions (Written Exams)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 1&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following SAS program is submitted:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;data one;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;addressl = ‘214 London Way’;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;run;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;data one;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;set one;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;address = tranwrd(address1, ‘Way’, ‘Drive’);&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;run;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;What are the length and value of the variable ADDRESS?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
A.&amp;nbsp;&amp;nbsp;&amp;nbsp; Length is 14; value is ‘214 London Dri’.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
B.&amp;nbsp;&amp;nbsp;&amp;nbsp; Length is 14; value is ‘214 London Way’.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
C.&amp;nbsp;&amp;nbsp;&amp;nbsp; Length is 16; value is ‘214 London Drive’.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;D.&amp;nbsp;&amp;nbsp; Length is 200; value is ‘214 London Drive’.&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 2&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following program is submitted.&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
data WORK.TEST;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; input Name $ Age;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
datalines;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
John +35&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Which values are stored in the output data set?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;A.&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Age&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;---------------------&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;John&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 35&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
B.&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Age&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
---------------------&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
John&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (missing value)&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
C.&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Age&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
---------------------&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
(missing value)&amp;nbsp;&amp;nbsp; (missing value)&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; list-style: none outside none; margin: 0px 0px 10px 40px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot; value=&quot;4&quot;&gt;The DATA step fails execution due to data errors.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 3&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Given the SAS data set WORK.ONE:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
Id&amp;nbsp; Char1&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
---&amp;nbsp; -----&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
182&amp;nbsp; M&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
190&amp;nbsp; N&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
250&amp;nbsp; O&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
720&amp;nbsp; P&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;and the SAS data set WORK.TWO:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;Id&amp;nbsp; Char2&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
---&amp;nbsp; -----&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
182&amp;nbsp; Q&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
623&amp;nbsp; R&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
720&amp;nbsp; S&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following program is submitted:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
data WORK.BOTH;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp; merge WORK.ONE WORK.TWO;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp; by Id;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;What is the first observation in the SAS data set WORK.BOTH?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; list-style: none outside none; margin: 0px 0px 10px 40px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;A. Id&amp;nbsp; Char1&amp;nbsp; Char2&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
---&amp;nbsp; -----&amp;nbsp; -----&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
182&amp;nbsp; M&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; list-style: none outside none; margin: 0px 0px 10px 40px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot; value=&quot;2&quot;&gt;B. Id&amp;nbsp; Char1&amp;nbsp; Char2&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
--- &amp;nbsp;-----&amp;nbsp; -----&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
182&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Q&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; list-style: none outside none; margin: 0px 0px 10px 40px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot; value=&quot;3&quot;&gt;&lt;b&gt;&lt;i&gt;C. Id&amp;nbsp; Char1&amp;nbsp; Char2&lt;/i&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;---&amp;nbsp; -----&amp;nbsp; -----&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;182&amp;nbsp; M&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Q&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; list-style: none outside none; margin: 0px 0px 10px 40px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot; value=&quot;4&quot;&gt;D. Id&amp;nbsp; Char1&amp;nbsp; Char2&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
---&amp;nbsp; -----&amp;nbsp; -----&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
720&amp;nbsp; P&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 4&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Which program displays a listing of all data sets in the SASUSER library?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
A.&amp;nbsp;&amp;nbsp;&amp;nbsp; proc contents lib = sasuser.all; run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
B.&amp;nbsp;&amp;nbsp;&amp;nbsp; proc contents data = sasuser.all; run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
C.&amp;nbsp;&amp;nbsp;&amp;nbsp; proc contents lib = sasuser._alI_; run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;D.&amp;nbsp;&amp;nbsp; proc contents data = sasuser._all_; run;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 5&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following SAS program is submitted:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
proc format;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; value score&amp;nbsp; 1&amp;nbsp; - 50&amp;nbsp; = &#39;Fail&#39;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 51 - 100&amp;nbsp; = &#39;Pass&#39;;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Which one of the following PRINT procedure steps correctly applies the format?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
A.&amp;nbsp;&amp;nbsp;&amp;nbsp; proc print data = SASUSER.CLASS;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp; var test;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp; format test score;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&lt;b&gt;&lt;i&gt;B.&amp;nbsp;&amp;nbsp;&amp;nbsp; proc print data = SASUSER.CLASS;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; var test;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; format test score.;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;run;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
C.&amp;nbsp;&amp;nbsp;&amp;nbsp; proc print data = SASUSER.CLASS format = score;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp; var test;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
D.&amp;nbsp;&amp;nbsp; proc print data = SASUSER.CLASS format = score.;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp; var test;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 6&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&amp;nbsp;Given the text file COLORS.TXT:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
----+----1----+----2----+----&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
RED&amp;nbsp;&amp;nbsp;&amp;nbsp; ORANGE&amp;nbsp; YELLOW&amp;nbsp; GREEN&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
BLUE&amp;nbsp;&amp;nbsp; INDIGO&amp;nbsp; PURPLE&amp;nbsp; VIOLET&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
CYAN&amp;nbsp;&amp;nbsp; WHITE&amp;nbsp;&amp;nbsp; FUCSIA&amp;nbsp; BLACK&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
GRAY&amp;nbsp;&amp;nbsp; BROWN&amp;nbsp;&amp;nbsp; PINK&amp;nbsp;&amp;nbsp;&amp;nbsp; MAGENTA&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following SAS program is submitted:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
data WORK.COLORS;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; infile &#39;COLORS.TXT&#39;;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; input @1 Var1 $ @8 Var2 $ @;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; input @1 Var3 $ @8 Var4 $ @;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;What will the data set WORK.COLORS contain?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;A.&amp;nbsp;&amp;nbsp;&amp;nbsp; Var1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var3&amp;nbsp;&amp;nbsp;&amp;nbsp; Var4&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;------&amp;nbsp;&amp;nbsp; ------&amp;nbsp;&amp;nbsp; ------&amp;nbsp; ------&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;RED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORANGE&amp;nbsp;&amp;nbsp; RED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORANGE&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;BLUE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INDIGO&amp;nbsp;&amp;nbsp; BLUE&amp;nbsp;&amp;nbsp;&amp;nbsp; INDIGO&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;CYAN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHITE&amp;nbsp;&amp;nbsp;&amp;nbsp; CYAN&amp;nbsp;&amp;nbsp;&amp;nbsp; WHITE&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;GRAY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BROWN&amp;nbsp;&amp;nbsp;&amp;nbsp; GRAY&amp;nbsp;&amp;nbsp;&amp;nbsp; BROWN&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
B.&amp;nbsp;&amp;nbsp;&amp;nbsp; Var1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var3&amp;nbsp;&amp;nbsp;&amp;nbsp; Var4&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
------&amp;nbsp;&amp;nbsp; ------&amp;nbsp;&amp;nbsp; ------ &amp;nbsp;------&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
RED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORANGE&amp;nbsp;&amp;nbsp; BLUE&amp;nbsp;&amp;nbsp;&amp;nbsp; INDIGO&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
CYAN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHITE&amp;nbsp;&amp;nbsp;&amp;nbsp; GRAY&amp;nbsp;&amp;nbsp;&amp;nbsp; BROWN&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
C.&amp;nbsp;&amp;nbsp;&amp;nbsp; Var1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var3&amp;nbsp;&amp;nbsp;&amp;nbsp; Var4&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
------&amp;nbsp;&amp;nbsp; ------&amp;nbsp;&amp;nbsp; ------&amp;nbsp; ------&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
RED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORANGE&amp;nbsp;&amp;nbsp; YELLOW&amp;nbsp; GREEN&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
BLUE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INDIGO&amp;nbsp;&amp;nbsp; PURPLE&amp;nbsp; VIOLET&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
D.&amp;nbsp;&amp;nbsp; Var1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var3&amp;nbsp;&amp;nbsp;&amp;nbsp; Var4&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
------&amp;nbsp;&amp;nbsp; ------&amp;nbsp;&amp;nbsp; ------&amp;nbsp; ------&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
RED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORANGE&amp;nbsp;&amp;nbsp; YELLOW&amp;nbsp; GREEN&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
BLUE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INDIGO&amp;nbsp;&amp;nbsp; PURPLE&amp;nbsp; VIOLET&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
CYAN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHITE&amp;nbsp;&amp;nbsp;&amp;nbsp; FUCSIA&amp;nbsp; BLACK&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
GRAY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BROWN&amp;nbsp;&amp;nbsp;&amp;nbsp; PINK&amp;nbsp;&amp;nbsp;&amp;nbsp; MAGENTA&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 24pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 7&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following SAS program is submitted:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
data work.accounting;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
set work.dept1 work.dept2;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
jobcode = ‘FA1’;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
length jobcode $ 8;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;A character variable named JOBCODE is contained in both the WORK.DEPT1 and WORK.DEPT2 SAS data sets. The variable JOBCODE has a length of 5 in the WORK.DEPT1 data set and a length of 7 in the WORK.DEPT2 data set. What is the length of the variable JOBCODE in the output data set?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
A.&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;B.&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
C.&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
D.&amp;nbsp;&amp;nbsp; 8&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 8&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Given the SAS data set WORK.INPUT:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
Var1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var2&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
------&amp;nbsp;&amp;nbsp; -------&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; one&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; two&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; three&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; four&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; five&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following SAS program is submitted:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
data WORK.ONE WORK.TWO;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; set WORK.INPUT;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; if Var1=&#39;A&#39; then output WORK.ONE;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; output;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;How many observations will be in data set WORK.ONE?&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;A.&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
B.&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
C.&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
D.&amp;nbsp;&amp;nbsp; 5&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 9&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Given the following SAS error log&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
data WORK.OUTPUT;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp; set SASHELP.CLASS;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp; BMI=(Weight*703)/Height**2;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp; where bmi ge 20;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp; ERROR: Variable bmi is not on file SASHELP.CLASS.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;What change to the program will correct the error?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; list-style: none outside none; margin: 0px 0px 10px 40px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;i&gt;A. Replace the WHERE statement with an IF statement&lt;/i&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;B. Change the ** in the BMI formula to a single *&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;C. Change&amp;nbsp;bmi&amp;nbsp;to BMI in the WHERE statement&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;D. Add a (Keep=BMI) option to the SET statement&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 10&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following SAS program is submitted:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;footnote1 ‘Sales Report for Last Month’;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;footnote2 ‘Selected Products Only’;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;footnote3 ‘All Regions’;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;footnote4 ‘All Figures in Thousands of Dollars’;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;proc print data = sasuser.shoes;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;footnote2 ‘All Products’;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;run;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Which footnote(s) is/are displayed in the report?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
A.&amp;nbsp;&amp;nbsp;&amp;nbsp; All Products&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;B.&amp;nbsp;&amp;nbsp;&amp;nbsp; Sales Report for Last Month All Products&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
C.&amp;nbsp;&amp;nbsp;&amp;nbsp; All Products All Regions All Figures in Thousands of Dollars&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
D.&amp;nbsp;&amp;nbsp; Sales Report for Last Month All Products All Regions All Figures in Thousands of Dollars&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 11&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following SAS program is submitted:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
data WORK.LOOP;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; X = 0;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; do Index = 1 to 5&amp;nbsp; by&amp;nbsp; 2;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; X = Index;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; end;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Upon completion of execution, what are the values of the variables X and Index in the SAS data set named WORK.LOOP?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; list-style: none outside none; margin: 0px 0px 10px 40px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;A. X = 3, Index = 5&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;B. X = 5, Index = 5&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;C. X = 5, Index = 6&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;i&gt;D. X = 5, Index = 7&lt;/i&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 12&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;This item will ask you to provide a line of missing code;&amp;nbsp;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;The SAS data set WORK.INPUT contains 10 observations, and includes the numeric variable Cost.&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following SAS program is submitted to accumulate the total value of Cost for the 10 observations:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
data WORK.TOTAL;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; set WORK.INPUT;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; &amp;lt;insert code here&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; Total=Total+Cost;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Which statement correctly completes the program?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; list-style: none outside none; margin: 0px 0px 10px 40px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;A. keep Total;&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;i&gt;B. retain Total 0;&lt;/i&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;C. Total = 0;&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px;&quot;&gt;D. If _N_= 1 then Total = 0;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 13&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Given the raw data record DEPT:&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
----|----10---|----20---|----30&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
Printing 750&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following SAS program is submitted:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
data bonus;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
infile ‘dept’;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
input dept$ 1-11 number 13- 15;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;lt;insert statement here&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Which SAS statement completes the program and results in a value of ‘Printing750’ for the DEPARTMENT variable?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
A.&amp;nbsp;&amp;nbsp;&amp;nbsp; department = dept&amp;nbsp;||&amp;nbsp;number;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
B.&amp;nbsp;&amp;nbsp;&amp;nbsp; department = left(dept)&amp;nbsp;||&amp;nbsp;number;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
C.&amp;nbsp;&amp;nbsp;&amp;nbsp; department = trim(dept) number;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;D.&amp;nbsp;&amp;nbsp; department=trim(dept)||put(number,3.);&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 14&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;This question will ask you to provide a line of missing code.&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Given the following data set WORK.SALES:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
SalesID&amp;nbsp; SalesJan&amp;nbsp; FebSales&amp;nbsp; MarchAmt&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
-------&amp;nbsp; --------&amp;nbsp; --------&amp;nbsp; --------&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
W6790&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 400&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 350&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
W7693&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 125&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
W1387&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 300&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 250&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following SAS program is submitted:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
data WORK.QTR1;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp; set WORK.SALES;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp; array month{3} SalesJan FebSales MarchAmt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;insert code here&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Which statement should be inserted to produce the following output?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
SalesID&amp;nbsp; SalesJan&amp;nbsp; FebSales&amp;nbsp; MarchAmt&amp;nbsp; Qtr1&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
-------&amp;nbsp; --------&amp;nbsp; --------&amp;nbsp; --------&amp;nbsp; ----&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
W6790&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 400&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 350&amp;nbsp;&amp;nbsp; 800&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
W7693&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 125&amp;nbsp;&amp;nbsp; 250&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
W1387&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 300&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 250&amp;nbsp;&amp;nbsp; 550&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
A.&amp;nbsp;&amp;nbsp;&amp;nbsp; Qtr1&amp;nbsp;= sum(of month{_ALL_});&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
B.&amp;nbsp;&amp;nbsp;&amp;nbsp; Qtr1&amp;nbsp;= month{1} + month{2} + month{3};&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;C.&amp;nbsp;&amp;nbsp;&amp;nbsp; Qtr1&amp;nbsp;= sum(of month{*});&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
D.&amp;nbsp;&amp;nbsp; Qtr1&amp;nbsp;= sum(of month{3});&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 15&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The SAS data set SASUSER.HOUSES contains a variable PRICE which has been assigned a permanent label of “Asking Price”. Which SAS program temporarily replaces the label “Asking Price” with the label “Sale Price” in the output?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
A.&amp;nbsp;&amp;nbsp;&amp;nbsp; proc&amp;nbsp;print data = sasuser.houses; label price = “Sale Price”; run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
B.&amp;nbsp;&amp;nbsp;&amp;nbsp; proc&amp;nbsp;print data = sasuser.houses label; label price “Sale Price”; run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;C.&amp;nbsp;&amp;nbsp;&amp;nbsp; proc&amp;nbsp;print data = sasuser.houses label; label price = “Sale Price”; run;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
D.&amp;nbsp;&amp;nbsp; proc&amp;nbsp;print data = sasuser.houses; price = “Sale Price”; run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 16&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following SAS program is submitted:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
data WORK.TEMP;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; Char1=&#39;0123456789&#39;;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
&amp;nbsp; Char2=substr(Char1,3,4);&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 30pt; margin-top: 1em; padding: 0px;&quot;&gt;
run;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;What is the value of&amp;nbsp;Char2?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
A.&amp;nbsp;&amp;nbsp;&amp;nbsp; 23&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
B.&amp;nbsp;&amp;nbsp;&amp;nbsp; 34&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
C.&amp;nbsp;&amp;nbsp;&amp;nbsp; 345&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;D.&amp;nbsp;&amp;nbsp; 2345&amp;nbsp;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 17&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The SAS data sets WORK.EMPLOYEE and WORK.SALARY are shown below:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;WORK.EMPLOYEE WORK.SALARY&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;fname age name salary&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;Bruce 30 Bruce 25000&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;Dan 40 Bruce 35000&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;Dan 25000&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following SAS program is submitted:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;data work.empdata;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;by fname;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;totsal + salary;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;run;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Which one of the following statements completes the merge of the two data sets by the FNAME variable?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
A.&amp;nbsp;&amp;nbsp;&amp;nbsp; merge work.employee&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
work.salary (fname = name);&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
B.&amp;nbsp;&amp;nbsp;&amp;nbsp; merge work.employee&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
work.salary (name = fname);&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
C.&amp;nbsp;&amp;nbsp;&amp;nbsp; merge work.employee&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
work.salary (rename = (fname = name));&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;D.&amp;nbsp;&amp;nbsp; merge work.employee&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;work.salary (rename = (name = fname));&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;&lt;u&gt;QUESTION 18&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;The following SAS program is submitted:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;data work.sets;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;do until (prod gt 6);&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;prod + 1;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;end;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-left: 36pt; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;em&gt;run;&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;What is the value of the variable PROD in the output data set?&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;strong&gt;Options:&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
A.&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b&gt;&lt;i&gt;B.&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
C.&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #464646; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19.5px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
D.&amp;nbsp;&amp;nbsp;&amp;nbsp;(missing numeric)&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/7092864218138609469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2016/06/base-sas-interview-questions-written.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/7092864218138609469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/7092864218138609469'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2016/06/base-sas-interview-questions-written.html' title='BASE SAS : Interview Questions (Written Exams)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-999101564299591153</id><published>2014-07-19T09:57:00.005+05:30</published><updated>2014-07-19T09:57:59.975+05:30</updated><title type='text'>How can I put a value from a data file to a Macro Variable?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif; line-height: 1.2em; margin-bottom: 10px; text-align: left;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;We can use the SYMPUT&amp;nbsp;function to get information from a data file to a SAS Macro variable.&amp;nbsp; Consider the example below.&amp;nbsp; We have a data file&amp;nbsp;test&amp;nbsp;and we have used&amp;nbsp;proc means&amp;nbsp;to save the mean of&amp;nbsp;x&amp;nbsp;to&amp;nbsp;xbar&amp;nbsp;in a new data file named&amp;nbsp;testmean.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;blockquote style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: medium; font-weight: normal; margin: 1em 5em;&quot;&gt;
&lt;pre style=&quot;font-size: 1.2em;&quot;&gt;&lt;b&gt;data test;
  input x ;
cards;
100
200
300
;
run;

proc means data=test;
  var x;
  output out=testmean mean=xbar;
run;&lt;/b&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif; font-weight: normal; line-height: 1.2em; margin-bottom: 10px;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;We would like to get the value of&amp;nbsp;&lt;b&gt;xbar&lt;/b&gt;&amp;nbsp;into a macro variable to be used elsewhere.&amp;nbsp; Below, we use the&amp;nbsp;&lt;b&gt;symput&lt;/b&gt;&amp;nbsp;command to put the value of&amp;nbsp;&lt;b&gt;xbar&lt;/b&gt;&amp;nbsp;into a macro variable called&amp;nbsp;&lt;b&gt;xbarmac&lt;/b&gt;. At the end of the data step we use&amp;nbsp;&lt;b&gt;%put&lt;/b&gt;&amp;nbsp;to display this value (to check that it worked) and then in&amp;nbsp;&lt;b&gt;test2&lt;/b&gt;&amp;nbsp;we can use this macro variable to create a mean-centered variable.&lt;/span&gt;&lt;/div&gt;
&lt;blockquote style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: medium; font-weight: normal; margin: 1em 5em;&quot;&gt;
&lt;pre style=&quot;font-size: 1.2em;&quot;&gt;&lt;b&gt;data _null_;
  set testmean;
  call symput(&quot;xbarmac&quot;,xbar);
run;

%put mean of x is &amp;amp;xbarmac;

data test2;
  set test;
  xcent = x - &amp;amp;xbarmac;
run;

proc print data=test2;
run;&lt;/b&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif; font-weight: normal; line-height: 1.2em; margin-bottom: 10px;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Below is the part of the log that shows the value of the macro variable.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif; line-height: 1.2em; margin-bottom: 10px;&quot;&gt;
&lt;span style=&quot;line-height: 1.2em;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&amp;nbsp;%put mean of X is &amp;amp;xbarmac;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;blockquote style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: medium; font-weight: normal; margin: 1em 5em;&quot;&gt;
&lt;pre style=&quot;font-size: 1.2em;&quot;&gt;&lt;b&gt;mean of X is          200&lt;/b&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;font-family: Arial, Helvetica, sans-serif; font-weight: normal; line-height: 1.2em; margin-bottom: 10px;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;And below we see the output of&amp;nbsp;&lt;b&gt;proc print&lt;/b&gt;, and indeed&amp;nbsp;&lt;b&gt;xcent&lt;/b&gt;&amp;nbsp;contains&amp;nbsp;&lt;b&gt;x&lt;/b&gt;&amp;nbsp;minus the mean of&amp;nbsp;&lt;b&gt;x&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;blockquote style=&quot;font-family: Arial, Helvetica, sans-serif; font-weight: normal; margin: 1em 5em;&quot;&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Obs     x     xcent
1     100     -100
2     200       0
&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;3          300           100&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;blockquote style=&quot;font-family: Arial, Helvetica, sans-serif; font-weight: normal; margin: 1em 5em;&quot;&gt;
&lt;pre&gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;blockquote style=&quot;font-family: Arial, Helvetica, sans-serif; font-weight: normal; margin: 1em 5em;&quot;&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/999101564299591153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2014/07/how-can-i-put-value-from-data-file-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/999101564299591153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/999101564299591153'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2014/07/how-can-i-put-value-from-data-file-to.html' title='How can I put a value from a data file to a Macro Variable?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-4148727547948861088</id><published>2013-12-30T20:42:00.003+05:30</published><updated>2013-12-30T20:42:34.333+05:30</updated><title type='text'>General Date and Time Functions On SAS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
datepart – Extract date from date time value&lt;br /&gt;
dateonly = datepart(fulldate);&lt;br /&gt;
day,month year – Extract part of a date value&lt;br /&gt;
day = day(date);&lt;br /&gt;
dhms – Construct value from date, hour, minute and second&lt;br /&gt;
dtval = dhms(date,9,15,0);&lt;br /&gt;
mdy – Construct date from month, day and year&lt;br /&gt;
date = mdy(mon,day,1996);&lt;br /&gt;
time – Returns the current time of day&lt;br /&gt;
now = time();&lt;br /&gt;
today – Returns the current date&lt;br /&gt;
datenow = today();&lt;br /&gt;
intck – Returns the number of intervals between two values&lt;br /&gt;
days = intck(’day’,then,today());&lt;br /&gt;
intnx – Increments a value by a number of intervals&lt;br /&gt;
tomrw = intnx(’day’,today(),1);&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/4148727547948861088/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2013/12/general-date-and-time-functions-on-sas.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/4148727547948861088'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/4148727547948861088'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2013/12/general-date-and-time-functions-on-sas.html' title='General Date and Time Functions On SAS'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-5167592163391010039</id><published>2013-12-18T14:06:00.000+05:30</published><updated>2013-12-18T14:08:42.080+05:30</updated><title type='text'>Difference In Excel, Access &amp; SAS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse; mso-yfti-tbllook: 1536; width: 721px;&quot;&gt;
 &lt;colgroup&gt;&lt;col style=&quot;mso-width-source: userset; width: 49pt;&quot; width=&quot;65&quot;&gt;&lt;/col&gt;
 &lt;col style=&quot;mso-width-source: userset; width: 132pt;&quot; width=&quot;176&quot;&gt;&lt;/col&gt;
 &lt;col style=&quot;mso-width-source: userset; width: 126pt;&quot; width=&quot;168&quot;&gt;&lt;/col&gt;
 &lt;col style=&quot;mso-width-source: userset; width: 107pt;&quot; width=&quot;143&quot;&gt;&lt;/col&gt;
 &lt;col style=&quot;mso-width-source: userset; width: 127pt;&quot; width=&quot;170&quot;&gt;&lt;/col&gt;
 &lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr height=&quot;29&quot; style=&quot;height: 21.6pt; mso-height-source: userset;&quot;&gt;
  &lt;td class=&quot;oa1&quot; height=&quot;29&quot; style=&quot;height: 21.6pt; width: 49pt;&quot; width=&quot;65&quot;&gt;&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.23in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;br /&gt;
&lt;!--[endif]--&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa2&quot; style=&quot;width: 132pt;&quot; width=&quot;176&quot;&gt;&lt;div style=&quot;direction: ltr; margin: 7.2pt 0in 0pt 0.23in; text-align: center; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;color: white; font-family: Arial; font-size: 12pt; font-weight: bold; vertical-align: baseline;&quot;&gt;Description &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa3&quot; style=&quot;width: 126pt;&quot; width=&quot;168&quot;&gt;&lt;div style=&quot;direction: ltr; margin: 7.2pt 0in 0pt 0.23in; text-align: center; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;color: white; font-family: Arial; font-size: 12pt; font-weight: bold; vertical-align: baseline;&quot;&gt;Advantages &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa3&quot; style=&quot;width: 107pt;&quot; width=&quot;143&quot;&gt;&lt;div style=&quot;direction: ltr; margin: 7.2pt 0in 0pt 0.23in; text-align: center; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;color: white; font-family: Arial; font-size: 12pt; font-weight: bold; vertical-align: baseline;&quot;&gt;Disadvantages &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa4&quot; style=&quot;width: 127pt;&quot; width=&quot;170&quot;&gt;&lt;div style=&quot;direction: ltr; margin: 7.2pt 0in 0pt 0.23in; text-align: center; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr height=&quot;138&quot; style=&quot;height: 103.2pt; mso-height-source: userset;&quot;&gt;
  &lt;td class=&quot;oa5&quot; height=&quot;138&quot; style=&quot;height: 103.2pt; width: 49pt;&quot; width=&quot;65&quot;&gt;&lt;div style=&quot;direction: ltr; margin: 7.2pt 0in 0pt; text-align: center; text-indent: 0in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-family: Arial; font-size: 12pt; font-weight: bold; vertical-align: baseline;&quot;&gt;Excel
  &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa6&quot; style=&quot;width: 132pt;&quot; width=&quot;176&quot;&gt;&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; font-family: Wingdings; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;§&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;Data
  manipulation and analysis program for which the user provides &lt;/span&gt;&lt;u&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;cell-based
  data and instructions &lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;to
  produce numerical and graphical output &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa6&quot; style=&quot;width: 126pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; font-family: Wingdings; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;§&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;Cell-based
  model creation &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; font-family: Wingdings; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;§&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;Ability
  to model &quot;what-if&quot; scenarios&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; font-family: Wingdings; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;§&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;Comprehensive
  graphing and print formatting functions &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa6&quot; style=&quot;width: 107pt;&quot; width=&quot;143&quot;&gt;&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; font-family: Wingdings; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;§&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;Basic
  functionality for novice users (extended greatly if you know macros) &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa6&quot; style=&quot;width: 127pt;&quot; width=&quot;170&quot;&gt;&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr height=&quot;153&quot; style=&quot;height: 115.1pt; mso-height-source: userset;&quot;&gt;
  &lt;td class=&quot;oa5&quot; height=&quot;153&quot; style=&quot;height: 115.1pt; width: 49pt;&quot; width=&quot;65&quot;&gt;&lt;div style=&quot;direction: ltr; margin: 7.2pt 0in 0pt; text-align: center; text-indent: 0in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-family: Arial; font-size: 12pt; font-weight: bold; vertical-align: baseline;&quot;&gt;Access
  &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa6&quot; style=&quot;width: 132pt;&quot; width=&quot;176&quot;&gt;&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; font-family: Wingdings; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;§&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;Data
  storage and retrieval program for which the user provides &lt;/span&gt;&lt;u&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;record
  and table-based data and instructions&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;
  to produce numerical, textual (typically tabular) and graphical output&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa6&quot; style=&quot;width: 126pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; font-family: Wingdings; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;&amp;nbsp;§ &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;Ability
  to:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;O1&quot; style=&quot;direction: ltr; margin: 0pt 0in 0pt 0.36in; text-indent: -0.16in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;–&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;Structure
  complex and interrelated data&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;O1&quot; style=&quot;direction: ltr; margin: 0pt 0in 0pt 0.36in; text-indent: -0.16in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;–&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;Run
  complex queries on data&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;O1&quot; style=&quot;direction: ltr; margin: 0pt 0in 0pt 0.36in; text-indent: -0.16in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;–&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;Develop
  customer applications &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa6&quot; style=&quot;width: 107pt;&quot; width=&quot;143&quot;&gt;&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; font-family: Wingdings; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;§&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;Substantial
  setup time for structuring data and creating tables&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; font-family: Wingdings; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;§&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; vertical-align: baseline;&quot;&gt;Can&#39;t
  easily manipulate data in individual cells &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa6&quot; style=&quot;width: 127pt;&quot; width=&quot;170&quot;&gt;&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr height=&quot;107&quot; style=&quot;height: 79.98pt; mso-height-source: userset;&quot;&gt;
  &lt;td class=&quot;oa7&quot; height=&quot;107&quot; style=&quot;height: 79.98pt; width: 49pt;&quot; width=&quot;65&quot;&gt;&lt;div style=&quot;direction: ltr; margin: 7.2pt 0in 0pt; text-align: center; text-indent: 0in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-family: Arial; font-size: 12pt; font-weight: bold; vertical-align: baseline;&quot;&gt;SAS
  &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa8&quot; style=&quot;width: 132pt;&quot; width=&quot;176&quot;&gt;&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; font-family: Wingdings; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;§&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; font-weight: bold; vertical-align: baseline;&quot;&gt;High-power
  &lt;/span&gt;&lt;u&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; font-weight: bold; vertical-align: baseline;&quot;&gt;record
  and table-based data&lt;/span&gt;&lt;/u&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; font-weight: bold; vertical-align: baseline;&quot;&gt;
  analysis tool for managing queries and statistical analysis &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa8&quot; style=&quot;width: 126pt;&quot; width=&quot;168&quot;&gt;&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; font-family: Wingdings; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;§&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; font-weight: bold; vertical-align: baseline;&quot;&gt;More
  powerful analytic functions &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa8&quot; style=&quot;width: 107pt;&quot; width=&quot;143&quot;&gt;&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-size: 10.0pt;&quot;&gt;&lt;span style=&quot;color: #3333cc; font-family: Wingdings; mso-color-index: 5; mso-special-format: bullet;&quot;&gt;§&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial; font-size: 10pt; font-weight: bold; vertical-align: baseline;&quot;&gt;Limited
  applicability and access to program &lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td class=&quot;oa8&quot; style=&quot;width: 127pt;&quot; width=&quot;170&quot;&gt;&lt;div class=&quot;O0&quot; style=&quot;direction: ltr; margin: 6pt 0in 0pt 0.18in; text-indent: -0.18in; unicode-bidi: embed; vertical-align: baseline; word-break: normal;&quot;&gt;
&lt;span style=&quot;font-family: Arial; font-size: 10pt; font-weight: bold; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/5167592163391010039/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2013/12/difference-in-excel-access-sas.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/5167592163391010039'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/5167592163391010039'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2013/12/difference-in-excel-access-sas.html' title='Difference In Excel, Access &amp; SAS'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-8960924426164402125</id><published>2013-12-17T17:19:00.000+05:30</published><updated>2013-12-17T17:19:05.011+05:30</updated><title type='text'>SAS Question- Replace &#39; Mr &#39; with &#39;Dr&#39; in a dataset.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Example 1.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Data a;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;input name $ 1-15;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;new_name=prxchange(&#39;s/\Mr /Dr /i&#39;,-1,name);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cards;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Mr Mridul&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Mr Mrinda&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;;run;&lt;br /&gt;
&lt;br /&gt;
Example 2.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; data test;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; length have want1 want2 $20;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; have=&#39; Mr Mridul&#39;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;want1=tranwrd(have,&#39;Mr &#39;,&#39;Dr &#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; want2=prxchange(&#39;s/^ *Mr\b/Dr/oi&#39;,1,have);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;run;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example 3.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DATA a;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;INPUT name $ 1-15;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DATALINES;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Mr Mridul&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Mr Mrinda&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;RUN;&lt;br /&gt;
&lt;br /&gt;
Example 4.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DATA a;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SET a;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; name = TRANWRD(SCAN(name, 1, &#39; &#39;), &#39;Mr&#39;, &#39;Dr &#39;) || SCAN(name, 2, &#39; &#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;RUN;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/8960924426164402125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2013/12/sas-question-replace-mr-with-dr-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/8960924426164402125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/8960924426164402125'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2013/12/sas-question-replace-mr-with-dr-in.html' title='SAS Question- Replace &#39; Mr &#39; with &#39;Dr&#39; in a dataset.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/10770536584075922269</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-2311027404339466528</id><published>2013-12-17T17:04:00.001+05:30</published><updated>2013-12-17T17:09:04.342+05:30</updated><title type='text'>SAS Code  for Question When a blue moon Occure?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;When there are two full moons in a single month, the second is&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;known as a blue moon. Given that July 9, 1998 is a full moon, and&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;there are 29 days between full moons, in what months will the next&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;few blue moons occur?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;Solution--&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;data fullmoon;&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;date = ’09jul98’d;&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;do i=1 to 500;&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;month = month(date);&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;year = year(date);&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;output;&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;date = intnx(’day’,date,29);&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;end;&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;run;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;Now we can use the put function to create a variable with the full&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;month name and the year.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;data bluemoon;&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;set fullmoon;&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;by year month;&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;if last.month and not first.month then do;&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;when = put(date,monname.) || &quot;, &quot; || put(date,year.);&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;output;&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;end;&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;run;&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;proc print data=bluemoon noobs;&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;var when;&lt;/span&gt;&lt;br style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;&lt;span style=&quot;font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;run; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/2311027404339466528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2013/12/sas-code-for-question-when-blue-moon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/2311027404339466528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/2311027404339466528'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2013/12/sas-code-for-question-when-blue-moon.html' title='SAS Code  for Question When a blue moon Occure?'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/10770536584075922269</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-5076482707297355556</id><published>2013-12-12T08:57:00.002+05:30</published><updated>2013-12-12T08:57:49.862+05:30</updated><title type='text'>Base SAS Certification Question Papers With Answers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;a href=&quot;https://www.dropbox.com/s/rsoaq486ivcgytr/A00-201-F.zip&quot; target=&quot;_blank&quot;&gt;Click here &lt;/a&gt;to download Base SAS question paper 1.&lt;br /&gt;
&lt;a href=&quot;https://www.dropbox.com/s/f8ljtnmqshkntlc/A00-211-s.zip&quot; target=&quot;_blank&quot;&gt;Click here&lt;/a&gt; to download Base SAS question paper 2.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;To download Advance SAS question paper 1 &lt;a href=&quot;https://www.dropbox.com/s/1j4f69ksauefkxc/A00-202-F.zip&quot; target=&quot;_blank&quot;&gt;Click here &lt;/a&gt;&lt;br /&gt;
&amp;nbsp;To download Advance SAS question paper 2 &lt;a href=&quot;https://www.dropbox.com/s/i3xvn2orwl4ney6/A00-212-s.zip&quot; target=&quot;_blank&quot;&gt;Click here &lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/5076482707297355556/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2013/12/base-sas-certification-question-papers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/5076482707297355556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/5076482707297355556'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2013/12/base-sas-certification-question-papers.html' title='Base SAS Certification Question Papers With Answers'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-6985808820528031667</id><published>2013-11-22T00:36:00.002+05:30</published><updated>2013-11-22T00:36:17.755+05:30</updated><title type='text'>Review: An Introduction to the SAS System Part-3</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:DocumentProperties&gt;
  &lt;o:Version&gt;12.00&lt;/o:Version&gt;
 &lt;/o:DocumentProperties&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;br /&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:DontVertAlignCellWithSp/&gt;
   &lt;w:DontBreakConstrainedForcedTables/&gt;
   &lt;w:DontVertAlignInTxbx/&gt;
   &lt;w:Word11KerningPairs/&gt;
   &lt;w:CachedColBalance/&gt;
  &lt;/w:Compatibility&gt;
  &lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val=&quot;Cambria Math&quot;/&gt;
   &lt;m:brkBin m:val=&quot;before&quot;/&gt;
   &lt;m:brkBinSub m:val=&quot;--&quot;/&gt;
   &lt;m:smallFrac m:val=&quot;off&quot;/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val=&quot;0&quot;/&gt;
   &lt;m:rMargin m:val=&quot;0&quot;/&gt;
   &lt;m:defJc m:val=&quot;centerGroup&quot;/&gt;
   &lt;m:wrapIndent m:val=&quot;1440&quot;/&gt;
   &lt;m:intLim m:val=&quot;subSup&quot;/&gt;
   &lt;m:naryLim m:val=&quot;undOvr&quot;/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState=&quot;false&quot; DefUnhideWhenUsed=&quot;true&quot;
  DefSemiHidden=&quot;true&quot; DefQFormat=&quot;false&quot; DefPriority=&quot;99&quot;
  LatentStyleCount=&quot;267&quot;&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;0&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Normal&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;heading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;35&quot; QFormat=&quot;true&quot; Name=&quot;caption&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;10&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; Name=&quot;Default Paragraph Font&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;11&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtitle&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;22&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Strong&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;20&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;59&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Table Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Placeholder Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;No Spacing&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Revision&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;34&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;List Paragraph&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;29&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;30&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;19&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;21&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;31&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;32&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;33&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Book Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;37&quot; Name=&quot;Bibliography&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; QFormat=&quot;true&quot; Name=&quot;TOC Heading&quot;/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:&quot;Table Normal&quot;;
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-priority:99;
 mso-style-qformat:yes;
 mso-style-parent:&quot;&quot;;
 mso-padding-alt:0in 5.4pt 0in 5.4pt;
 mso-para-margin-top:0in;
 mso-para-margin-right:0in;
 mso-para-margin-bottom:10.0pt;
 mso-para-margin-left:0in;
 line-height:115%;
 mso-pagination:widow-orphan;
 font-size:11.0pt;
 font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
 mso-ascii-font-family:Calibri;
 mso-ascii-theme-font:minor-latin;
 mso-fareast-font-family:&quot;Times New Roman&quot;;
 mso-fareast-theme-font:minor-fareast;
 mso-hansi-font-family:Calibri;
 mso-hansi-theme-font:minor-latin;
 mso-bidi-font-family:&quot;Times New Roman&quot;;
 mso-bidi-theme-font:minor-bidi;}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Multiple Data Sets: Overview&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
One of SAS’s greatest strengths is its ability to combine and&lt;br /&gt;
process more than one data set at a time. The main tools used to&lt;br /&gt;
do this are the set, merge and update statements, along with the&lt;br /&gt;
by statement and first. and last. variables.&lt;br /&gt;
We’ll look at the following situations:&lt;br /&gt;
• Concatenating datasets by observation&lt;br /&gt;
• Interleaving several datasets based on a single variable value&lt;br /&gt;
• One-to-one matching&lt;br /&gt;
• Simple Merge Matching, including table lookup&lt;br /&gt;
• More complex Merge Matching&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Concatenating Data Sets by Observation&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The simplest operation concerning multiple data sets is to&lt;br /&gt;
concatenate data sets by rows to form one large data set from&lt;br /&gt;
several other data sets. To do this, list the sets to be concatenated&lt;br /&gt;
on a set statement; each data set will be processed in turn,&lt;br /&gt;
creating an output data set in the usual way.&lt;br /&gt;
For example, suppose we wish to create a data set called last by&lt;br /&gt;
concatenating the data sets first, second, and third.&lt;br /&gt;
data last;&lt;br /&gt;
set first second third;&lt;br /&gt;
If there are variables in some of the data sets which are not in the&lt;br /&gt;
others, those variables will be set to missing (. or ’ ’) in&lt;br /&gt;
observations derived from the data sets which lacked the variable in&lt;br /&gt;
question.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Concatenating Data Sets (cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Consider two data sets clerk and manager:&lt;br /&gt;
Name Store Position Rank Name Store Position Staff&lt;br /&gt;
Joe Central Sales 5 Fred Central Manager 10&lt;br /&gt;
Harry Central Sales 5 John Mall Manager 12&lt;br /&gt;
Sam Mall Stock 3&lt;br /&gt;
The SAS statements to concatenate the data sets are:&lt;br /&gt;
data both;&lt;br /&gt;
set clerk manager;&lt;br /&gt;
run;&lt;br /&gt;
resulting in the following data set:&lt;br /&gt;
Name Store Position Rank Staff&lt;br /&gt;
Joe Central Sales 5 .&lt;br /&gt;
Harry Central Sales 5 .&lt;br /&gt;
Sam Mall Stock 3 .&lt;br /&gt;
Fred Central Manager . 10&lt;br /&gt;
John Mall Manager . 12&lt;br /&gt;
Note that the variable staff is missing for all observations from set&lt;br /&gt;
clerk, and rank is missing for all observations from manager. The&lt;br /&gt;
observations are in the same order as the input data sets.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Concatenating Data Sets with proc append&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
If the two data sets you wish to concatenate contain exactly the&lt;br /&gt;
same variables, you can save resources by using proc append&lt;br /&gt;
instead of the set statement, since the set statement must process&lt;br /&gt;
each observation in the data sets, even though they will not be&lt;br /&gt;
changed. Specify the “main” data set using the base= argument&lt;br /&gt;
and the data set to be appended using the new= argument. For&lt;br /&gt;
example, suppose we wish to append the observations in a data set&lt;br /&gt;
called new to a data set called master.enroll. Assuming that&lt;br /&gt;
both data sets contained the same variables, you could use proc&lt;br /&gt;
append as follows:&lt;br /&gt;
proc append base=master.enroll new=new;&lt;br /&gt;
run;&lt;br /&gt;
The SAS System will print an error message if the variables in the&lt;br /&gt;
two data sets are not the same.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Interleaving Datasets based on a Single
Variable&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
If you want to combine several datasets so that observations&lt;br /&gt;
sharing a common value are all adjacent to each other, you can list&lt;br /&gt;
the datasets on a set statement, and specify the variable to be&lt;br /&gt;
used on a by statement. Each of the datasets must be sorted by the&lt;br /&gt;
variable on the by statement.&lt;br /&gt;
For example, suppose we had three data sets A, B, and C, and each&lt;br /&gt;
contained information about employees at different locations:&lt;br /&gt;
Set A Set B Set C&lt;br /&gt;
Loc Name Salary Loc Name Salary Loc Name Salary&lt;br /&gt;
NY Harry 25000 LA John 18000 NY Sue 19000&lt;br /&gt;
NY Fred 20000 NY Joe 25000 NY Jane 22000&lt;br /&gt;
NY Jill 28000 SF Bill 19000 SF Sam 23000&lt;br /&gt;
SF Bob 19000 SF Amy 29000 SF Lyle 22000&lt;br /&gt;
Notice that there are not equal numbers of observations from the&lt;br /&gt;
different locations in each data set.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Interleaving Datasets (cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
To combine the three data sets, we would use a set statement&lt;br /&gt;
combined with a by statement.&lt;br /&gt;
data all;&lt;br /&gt;
set a b c;&lt;br /&gt;
by loc;&lt;br /&gt;
run;&lt;br /&gt;
which would result in the following data set:&lt;br /&gt;
Loc Name Salary Loc Name Salary&lt;br /&gt;
LA John 18000 NY Jane 22000&lt;br /&gt;
NY Harry 25000 SF Bob 19000&lt;br /&gt;
NY Fred 20000 SF Bill 19000&lt;br /&gt;
NY Jill 28000 SF Amy 29000&lt;br /&gt;
NY Joe 25000 SF Sam 23000&lt;br /&gt;
NY Sue 19000 SF Lyle 22000&lt;br /&gt;
Similar results could be obtained through a proc sort on the&lt;br /&gt;
concatenated data set, but this technique is more efficient and&lt;br /&gt;
allows for further processing by including programming statements&lt;br /&gt;
before the run;.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;One-to-one matching&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
To combine variables from several data sets where there is a&lt;br /&gt;
one-to-one correspondence between the observations in each of the&lt;br /&gt;
data sets, list the data sets to be joined on a merge statement. The&lt;br /&gt;
output data set created will have as many observations as the&lt;br /&gt;
largest data set on the merge statement. If more than one data set&lt;br /&gt;
has variables with the same name, the value from the rightmost&lt;br /&gt;
data set on the merge statement will be used.&lt;br /&gt;
You can use as many data sets as you want on the merge&lt;br /&gt;
statement, but remember that they will be combined in the order&lt;br /&gt;
in which the observations occur in the data set.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Example: one-to-one matching&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
For example, consider the data sets personal and business:&lt;br /&gt;
Personal Business&lt;br /&gt;
Name Age Eyes Name Job Salary&lt;br /&gt;
Joe 23 Blue Joe Clerk 20000&lt;br /&gt;
Fred 30 Green Fred Manager 30000&lt;br /&gt;
Sue 24 Brown Sue Cook 24000&lt;br /&gt;
To merge the variables in business with those in personal, use&lt;br /&gt;
data both;&lt;br /&gt;
merge personal business;&lt;br /&gt;
to result in data set both&lt;br /&gt;
Name Age Eyes Job Salary&lt;br /&gt;
Joe 23 Blue Clerk 20000&lt;br /&gt;
Fred 30 Green Manager 30000&lt;br /&gt;
Sue 24 Brown Cook 24000&lt;br /&gt;
Note that the observations are combined in the exact order in&lt;br /&gt;
which they were found in the input data sets.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Simple Match Merging&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
When there is not an exact one-to-one correspondence between&lt;br /&gt;
data sets to be merged, the variables to use to identify matching&lt;br /&gt;
observations can be specified on a by statement. The data sets&lt;br /&gt;
being merged must be sorted by the variables specified on the by&lt;br /&gt;
statement.&lt;br /&gt;
Notice that when there is exactly one observation with each by&lt;br /&gt;
variable value in each data set, this is the same as the one-to-one&lt;br /&gt;
merge described above. Match merging is especially useful if you’re&lt;br /&gt;
not sure exactly which observations are in which data sets.&lt;br /&gt;
By using the IN= data set option, explained later, you can&lt;br /&gt;
determine which from data set(s) a merged observation is derived.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Simple Match Merging (cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Suppose we have data for student’s grades on two tests, stored in&lt;br /&gt;
two separate files&lt;br /&gt;
ID Score1 Score2 ID Score3 Score4&lt;br /&gt;
7 20 18 7 19 12&lt;br /&gt;
9 15 19 10 12 20&lt;br /&gt;
12 9 15 12 10 19&lt;br /&gt;
Clearly a one-to-one merge would not be appropriate.&lt;br /&gt;
Pay particular attention to ID 9, which appears only in the first&lt;br /&gt;
data set, and ID 10 which appears only in the second set.&lt;br /&gt;
To merge the observations, combining those with common values of&lt;br /&gt;
ID we could use the following SAS statements:&lt;br /&gt;
data both;&lt;br /&gt;
merge scores1 scores2;&lt;br /&gt;
by id;&lt;br /&gt;
run;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Simple Match Merging (cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Here’s the result of the merge:&lt;br /&gt;
ID Score1 Score2 Score3 Score4&lt;br /&gt;
7 20 18 19 12&lt;br /&gt;
9 15 19 . .&lt;br /&gt;
10 . . 12 20&lt;br /&gt;
12 9 15 10 19&lt;br /&gt;
Notes&lt;br /&gt;
1. All datasets must be sorted by the variables on the by&lt;br /&gt;
statement.&lt;br /&gt;
2. If an observation was missing from one or more data sets, the&lt;br /&gt;
values of the variables which were found only in the missing&lt;br /&gt;
data set(s) are set to missing.&lt;br /&gt;
3. If there are multiple occurences of a common variable in the&lt;br /&gt;
merged data sets, the value from the rightmost data set is used.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Table Lookup&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Consider a dataset containing a patient name and a room number,&lt;br /&gt;
and a second data set with doctors names corresponding to each of&lt;br /&gt;
the room numbers. There are many observations with the same&lt;br /&gt;
room number in the first data set, but exactly one observation for&lt;br /&gt;
each room number in the second data set. Such a situation is called&lt;br /&gt;
table lookup, and is easily handled with a merge statement&lt;br /&gt;
combined with a by statement.&lt;br /&gt;
Patients Doctors&lt;br /&gt;
Patient Room Doctor Room&lt;br /&gt;
Smith 215 Reed 215&lt;br /&gt;
Jones 215 Ellsworth 217&lt;br /&gt;
Williams 215 . . .&lt;br /&gt;
Johnson 217&lt;br /&gt;
Brown 217&lt;br /&gt;
. . .&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Table Lookup (cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The following statements combine the two data sets.&lt;br /&gt;
data both;&lt;br /&gt;
merge patients doctors;&lt;br /&gt;
by room;&lt;br /&gt;
run;&lt;br /&gt;
resulting in data set both&lt;br /&gt;
Patient Room Doctor&lt;br /&gt;
Smith 215 Reed&lt;br /&gt;
Jones 215 Reed&lt;br /&gt;
Williams 215 Reed&lt;br /&gt;
Johnson 217 Ellsworth&lt;br /&gt;
Brown 217 Ellsworth&lt;br /&gt;
Notes: . . .&lt;br /&gt;
• As always, both data sets must be sorted by the variables on&lt;br /&gt;
the by list.&lt;br /&gt;
• The data set with one observation per by variable must be the&lt;br /&gt;
second dataset on the merge statement.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Updating Data Sets&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
When you’re combining exactly two data sets with the goal of&lt;br /&gt;
updating some or all of the first data set’s values with values from&lt;br /&gt;
the second data set, you can use the update statement.&lt;br /&gt;
An update statement accepts exactly two data sets, and must be&lt;br /&gt;
followed by a by statement. An update statement is similar to a&lt;br /&gt;
merge statement except that&lt;br /&gt;
• the update statement will not overwrite non-missing values in&lt;br /&gt;
data set one with missing values from data set two, and&lt;br /&gt;
• the update statement doesn’t create any observations until all&lt;br /&gt;
the observations for a by group are processed. Thus, the first&lt;br /&gt;
data set should contain exactly one observation for each by&lt;br /&gt;
group, while the second data set can contain multiple&lt;br /&gt;
observations, with later observations supplementing or&lt;br /&gt;
overriding earlier ones.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Example: update statement&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Set orig Set upd&lt;br /&gt;
ID Account Balance ID Account Balance&lt;br /&gt;
1 2443 274.40 1 . 699.00&lt;br /&gt;
2 4432 79.95 2 2232 .&lt;br /&gt;
3 5002 615.00 2 . 189.95&lt;br /&gt;
3 6100 200.00&lt;br /&gt;
Data set orig can be updated with the values in upd using the&lt;br /&gt;
following statements:&lt;br /&gt;
data orig;&lt;br /&gt;
update orig upd;&lt;br /&gt;
by id;&lt;br /&gt;
resulting in the updated data set:&lt;br /&gt;
ID Account Balance&lt;br /&gt;
1 2443 699.00&lt;br /&gt;
2 2232 189.95&lt;br /&gt;
3 6100 200.00&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;More Complex Merging&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Keep the following in mind when performing more complex merges:&lt;br /&gt;
• If the merged data sets have variables in common (in addition&lt;br /&gt;
to the variables on the by statement), and the values differ, the&lt;br /&gt;
values from the rightmost data set in the merge statement are&lt;br /&gt;
used.&lt;br /&gt;
• If there are multiple occurences of observations with the same&lt;br /&gt;
value for the by variable(s) in the data sets being merged, they&lt;br /&gt;
are combined one-to-one. If there are unequal numbers of these&lt;br /&gt;
observations in any of the data sets being merged, the last&lt;br /&gt;
value from the data set with fewer observations is reused for all&lt;br /&gt;
the other observations with matching values.&lt;br /&gt;
• Various problems arise if variables in data sets being merged&lt;br /&gt;
have different attributes. Try to resolve these issues before&lt;br /&gt;
merging the data.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;More Complex Merging (cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The following example, although artificial, illustrates some of the&lt;br /&gt;
points about complex merging:&lt;br /&gt;
one two three&lt;br /&gt;
a b c a b d a b c d&lt;br /&gt;
1 3 20 1 3 17 1 3 20 17&lt;br /&gt;
1 3 19 1 5 12 1 5 19 12&lt;br /&gt;
1 7 22 2 9 21 =) 1 7 22 12&lt;br /&gt;
2 9 18 2 3 15 2 9 18 21&lt;br /&gt;
2 3 22 2 6 31 2 3 22 15&lt;br /&gt;
2 6 22 31&lt;br /&gt;
The data sets were merged with the following statements:&lt;br /&gt;
data three;&lt;br /&gt;
merge one two;&lt;br /&gt;
by a;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;in= data set option&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
When creating observations from multiple data sets, it is often&lt;br /&gt;
helpful to know which data set an observation should come from. It&lt;br /&gt;
should be clear that when merging large data sets, additional tools&lt;br /&gt;
will be necessary to determine exactly how observations are created.&lt;br /&gt;
The in= data set option is one such tool. The option is associated&lt;br /&gt;
with one or more of the data sets on a merge statement, and&lt;br /&gt;
specifies the name of a temporary variable which will have a value&lt;br /&gt;
of 1 if that data set contributed to the current observation and a 0&lt;br /&gt;
otherwise.&lt;br /&gt;
Two common uses of the in= variable are to make sure that only&lt;br /&gt;
complete records are output, and to create a data set of problem&lt;br /&gt;
observations which were missing from one of the merged data sets.&lt;br /&gt;
The next slide provides an example of these ideas, using the test&lt;br /&gt;
scores data from a previous example.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Example of in= data set option&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
data both problem;&lt;br /&gt;
merge scores1(in=one) scores2(in=two);&lt;br /&gt;
by id;&lt;br /&gt;
if one and two then output both;&lt;br /&gt;
else output problem;&lt;br /&gt;
run;&lt;br /&gt;
The resulting data sets are shown below; note that the in=&lt;br /&gt;
variables are not output to the data sets which are created.&lt;br /&gt;
Data set both&lt;br /&gt;
Obs Id Score1 Score2 Score3 Score4&lt;br /&gt;
1 7 20 18 19 12&lt;br /&gt;
2 12 9 15 10 19&lt;br /&gt;
Data set problem&lt;br /&gt;
Obs Id Score1 Score2 Score3 Score4&lt;br /&gt;
1 9 15 19 . .&lt;br /&gt;
2 10 . . 12 20&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Programming with by statements&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The power of the by statement coupled with the merge and set&lt;br /&gt;
statements is enough to solve most problems, but occasionally more&lt;br /&gt;
control is needed.&lt;br /&gt;
Internally, SAS creates two temporary variables for each variable&lt;br /&gt;
on the by statement of a data step. first.variable is equal to 1&lt;br /&gt;
if the current observation is the first occurence of this value of&lt;br /&gt;
variable and 0 otherwise. Similarly, last.variable is equal to 1&lt;br /&gt;
if the current observation is the last occurence of the value of&lt;br /&gt;
variable and 0 otherwise.&lt;br /&gt;
When there are several by variables, remember that a new&lt;br /&gt;
by-group begins when the value of the rightmost variable on the by&lt;br /&gt;
statement changes.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Application: Finding Duplicate
Observations I&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Many data sets are arranged so that there should be exactly one&lt;br /&gt;
observation for each unique combination of variable values. In the&lt;br /&gt;
simplest case, there may be an identifier like a social security or&lt;br /&gt;
student identification number, and we want to check to make sure&lt;br /&gt;
there are not multiple observations with the same value for that&lt;br /&gt;
variable.&lt;br /&gt;
If the data set is sorted by the identifier variable (say, ID), code like&lt;br /&gt;
the following will identify the duplicates:&lt;br /&gt;
data check;&lt;br /&gt;
set old;&lt;br /&gt;
by id;&lt;br /&gt;
if first.id and ^last.id;&lt;br /&gt;
run;&lt;br /&gt;
The duplicates can now be found in data set check&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Example of first. and last. variables&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Suppose we have a data set called grp with several observations for&lt;br /&gt;
each value of a variable called group. We wish to output one&lt;br /&gt;
observation for each group containing the three highest values of&lt;br /&gt;
the variable x encountered for that group.&lt;br /&gt;
data max;&lt;br /&gt;
set grp;&lt;br /&gt;
by group;&lt;br /&gt;
retain x1-x3; * preserve values btwn obs;&lt;br /&gt;
if first.group then do; * initialize&lt;br /&gt;
x1 = .; x2 = .; x3 = .;&lt;br /&gt;
end;&lt;br /&gt;
if x &amp;gt;= x1 then do;&lt;br /&gt;
x3 = x2; x2 = x1; x1 = x; end;&lt;br /&gt;
else if x &amp;gt;= x2 then do;&lt;br /&gt;
x3 = x2; x2 = x; end;&lt;br /&gt;
else if x &amp;gt;= x3 then x3 = x;&lt;br /&gt;
if last.group then output; * output one obs per group;&lt;br /&gt;
keep group x1-x3;&lt;br /&gt;
run;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Example of first. and last. variables
(cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Here are the results of a simple example of the previous program:&lt;br /&gt;
Set grp&lt;br /&gt;
Group X&lt;br /&gt;
1 16&lt;br /&gt;
1 12&lt;br /&gt;
1 19 Set max&lt;br /&gt;
1 15 Group X1 X2 X3&lt;br /&gt;
1 18 1 19 18 17&lt;br /&gt;
1 17 =) 2 30 20 14&lt;br /&gt;
2 10 3 59 45 18&lt;br /&gt;
2 20&lt;br /&gt;
2 8&lt;br /&gt;
2 14&lt;br /&gt;
2 30&lt;br /&gt;
3 59&lt;br /&gt;
3 45&lt;br /&gt;
3 2&lt;br /&gt;
3 18&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Sorting datasets&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
For procedures or data steps which need a data set to be sorted by&lt;br /&gt;
one or more variables, there are three options available:&lt;br /&gt;
1. You can use proc sort; to sort your data. Note that SAS&lt;br /&gt;
stores information about the sort in the dataset header, so that&lt;br /&gt;
it will not resort already sorted data.&lt;br /&gt;
2. You can enter your data in sorted order. If you choose this&lt;br /&gt;
option, make sure that you use the correct sorting order.* To&lt;br /&gt;
prevent proc sort from resorting your data, use the&lt;br /&gt;
sortedby= data set option when you create the data set.&lt;br /&gt;
3. You can create an index for one or more combinations of&lt;br /&gt;
variables which will stored along with the data set.&lt;br /&gt;
* EBCDIC Sorting Sequence (IBM mainframes):&lt;br /&gt;
blank
.&amp;lt;(+|\&amp;amp;!$*);^-/,%_&amp;gt;?‘:#@’=&quot;abcdefghijklmnopqr~stuvwxyz{ABCDEFGHI}JKLMNOOPQR\STUVWXYZ0123456789&lt;br /&gt;
ASCII Sorting Sequence (most other computers):&lt;br /&gt;
blank !&quot;#$%&amp;amp;’()*
+,-./0123456789:;&amp;lt;=&amp;gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_‘abcdefghijklmnopqrstuvwxyz{|}~&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Indexed Data Sets&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
If you will be processing a data set using by statements, or&lt;br /&gt;
subsetting your data based on the value(s) of one or more variables,&lt;br /&gt;
you may want to store an index based on those variables to speed&lt;br /&gt;
future processing.&lt;br /&gt;
proc datasets is used to create an index for a SAS data set.&lt;br /&gt;
Suppose we have a data set called company.employ, with variables&lt;br /&gt;
for branch and empno. To store a simple index (based on a single&lt;br /&gt;
variable), statements like the following are used:&lt;br /&gt;
proc datasets library=company;&lt;br /&gt;
modify employ;&lt;br /&gt;
index create branch;&lt;br /&gt;
run;&lt;br /&gt;
More than one index for a data set can be specified by including&lt;br /&gt;
multiple index statements. The index will be used whenever a by&lt;br /&gt;
statement with the indexed variable is encountered.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Indexed Data Sets (cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
To create a composite index (based on more than one variable),&lt;br /&gt;
you need to provide a label for the index. (This label need not be&lt;br /&gt;
specified when you access the data set.) You can have multiple&lt;br /&gt;
composite indices within the same data set:&lt;br /&gt;
proc datasets library=company;&lt;br /&gt;
modify employ;&lt;br /&gt;
index create brnum = (branch idnum);&lt;br /&gt;
run;&lt;br /&gt;
In the previous example, the composite index would mean the data&lt;br /&gt;
set is also indexed for branch, but not for idnum.&lt;br /&gt;
Note: If you are moving or copying an indexed data set, be sure to&lt;br /&gt;
use a SAS procedure like proc copy, datasets, or cport rather&lt;br /&gt;
than system utilities, to insure that the index gets correctly copied.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Formats and Informats&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Formats control the appearance of variable values in both&lt;br /&gt;
procedures and with the put statement of the data step. Most&lt;br /&gt;
procedures also use formats to group values using by statements.&lt;br /&gt;
Informats are used in conjunction with the input statement to&lt;br /&gt;
specify the way that variables are to be read if they are not in the&lt;br /&gt;
usual numeric or character format.&lt;br /&gt;
SAS provides a large number of predefined formats, as well as the&lt;br /&gt;
ability to write your own formats, for input as well as output.&lt;br /&gt;
If you include a format or attribute statement in the data step&lt;br /&gt;
when the data set is created, the formats will always be associated&lt;br /&gt;
with the data. Alternatively, you can use a format statement&lt;br /&gt;
within a procedure.&lt;br /&gt;
The system option nofmterr will eliminate errors produced by&lt;br /&gt;
missing formats.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Basic Formats&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Numeric formats are of the form w. or w.d, representing a field&lt;br /&gt;
width of w, and containing d decimal places.&lt;br /&gt;
put x 6.; *write x with field width of 6;&lt;br /&gt;
format price 8.2; *use field width of 8 and 2 d.p. for price;&lt;br /&gt;
The bestw. format can be used if you’re not sure about the&lt;br /&gt;
number of decimals. (For example, best6. or best8..)&lt;br /&gt;
Simple character formats are of the form $w., where w is the&lt;br /&gt;
desired field width. (Don’t forget the period.)&lt;br /&gt;
put name $20.; * write name with field width of 20;&lt;br /&gt;
format city $50.; * use field width of 50 for city;&lt;br /&gt;
You can also use formats with the put function to create character&lt;br /&gt;
variables formatted to your specifications:&lt;br /&gt;
x = 8;&lt;br /&gt;
charx = put(x,8.4);&lt;br /&gt;
creates a character variable called charx equal to 8.0000&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Informats&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The basic informats are the same as the basic formats, namely w.d&lt;br /&gt;
for numeric values, and $w. for character variables.&lt;br /&gt;
By default, leading blanks are stripped from character values. To&lt;br /&gt;
retain them, use the $charw. format.&lt;br /&gt;
When you specify a character informat wider than the default of 8&lt;br /&gt;
columns, SAS automatically will make sure the variable is big&lt;br /&gt;
enough to hold your input values.&lt;br /&gt;
Some Other SAS Informats&lt;br /&gt;
Name Description Name Description&lt;br /&gt;
hexw. numeric hexadecimal $hexw. character hexadecimal&lt;br /&gt;
octalw. numeric octal $octalw. character octal&lt;br /&gt;
bzw.d treat blanks as zeroes ew.d scientific notation&lt;br /&gt;
rbw.d floating point binary ibw.d integer binary&lt;br /&gt;
pdw.d packed decimal $ebcdicw. EBCDIC to ASCII&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Writing User-defined formats using proc
format&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
• You can specify several different value statements within a&lt;br /&gt;
single invocation of proc format.&lt;br /&gt;
• Each value must be given a name (which does not end in a&lt;br /&gt;
number), followed by a set of range/value pairs.&lt;br /&gt;
• The keywords low, high, and other can be used to construct&lt;br /&gt;
ranges.&lt;br /&gt;
• If you wish a range of values to be formatted using some other&lt;br /&gt;
format, enclose its name (including the period) in square&lt;br /&gt;
brackets ([ ]) as the value for that range.&lt;br /&gt;
• Character values should be enclosed in quotes; the name of a&lt;br /&gt;
character format must begin with a dollar sign ($).&lt;br /&gt;
• If a variable falls outside of the specified ranges, it is formatted&lt;br /&gt;
using the usual defaults&lt;br /&gt;
102&lt;br /&gt;
User-defined Format: Examples&lt;br /&gt;
For a variable with values from 1 to 5, the format qval. displays 1&lt;br /&gt;
and 2 as low, 3 as medium and 4 and 5 as high.&lt;br /&gt;
The format mf. displays values of 1 as male, 2 as female and all&lt;br /&gt;
other values as invalid.&lt;br /&gt;
The format tt. display values below .001 as undetected, and all&lt;br /&gt;
other values in the usual way.&lt;br /&gt;
proc format;&lt;br /&gt;
value qval 1-2=’low’ 3=’medium’ 4-5=’high’;&lt;br /&gt;
value mf 1=’male’ 2=’female’ other=’invalid’;&lt;br /&gt;
value tt low-.001=’undetected’;&lt;br /&gt;
run;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Recoding Values using Formats&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Since many SAS procedures use formatted values to produce&lt;br /&gt;
groups, you can often recode variables by simply changing their&lt;br /&gt;
formats. This is more efficient than processing an entire data set,&lt;br /&gt;
and leaves the original variable unchanged for future use.&lt;br /&gt;
Suppose we have a survey which asks people how long they’ve been&lt;br /&gt;
using computers (measured in years), and how happy they are with&lt;br /&gt;
the computer they are using (measured on a scale of 1 to 5). We&lt;br /&gt;
wish to produce a cross tabulation of these results, that is a table&lt;br /&gt;
where rows represent levels of one variable, columns represent the&lt;br /&gt;
level of another variable, and the entries represent the number of&lt;br /&gt;
observations which fall into the row/column categories. Often the&lt;br /&gt;
unformatted table will have many empty cells - it is common&lt;br /&gt;
practice to group categories or values to create more meaningful&lt;br /&gt;
tables.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Recoding Values using Formats (cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
If the two variables in our survey are called years and happy, the&lt;br /&gt;
following program would produce a cross tabulation:&lt;br /&gt;
proc freq;tables years*happy/nocol norow nocum nopct;&lt;br /&gt;
TABLE OF YEARS BY HAPPY&lt;br /&gt;
YEARS HAPPY&lt;br /&gt;
Frequency| 1| 2| 3| 4| 5| Total&lt;br /&gt;
---------+--------+--------+--------+--------+--------+&lt;br /&gt;
0.5 | 1 | 2 | 1 | 2 | 0 | 6&lt;br /&gt;
---------+--------+--------+--------+--------+--------+&lt;br /&gt;
1 | 0 | 0 | 2 | 2 | 0 | 4&lt;br /&gt;
---------+--------+--------+--------+--------+--------+&lt;br /&gt;
1.5 | 0 | 0 | 0 | 1 | 0 | 1&lt;br /&gt;
---------+--------+--------+--------+--------+--------+&lt;br /&gt;
2 | 0 | 0 | 2 | 2 | 3 | 7&lt;br /&gt;
---------+--------+--------+--------+--------+--------+&lt;br /&gt;
3 | 1 | 1 | 0 | 1 | 1 | 4&lt;br /&gt;
---------+--------+--------+--------+--------+--------+&lt;br /&gt;
8 | 0 | 0 | 0 | 0 | 1 | 1&lt;br /&gt;
---------+--------+--------+--------+--------+--------+&lt;br /&gt;
10 | 0 | 1 | 0 | 0 | 0 | 1&lt;br /&gt;
---------+--------+--------+--------+--------+--------+&lt;br /&gt;
12 | 0 | 0 | 0 | 1 | 0 | 1&lt;br /&gt;
---------+--------+--------+--------+--------+--------+&lt;br /&gt;
Total 2 4 5 9 5 25&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Recoding Values using Formats (cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
To make the table more useful, we define the following formats:&lt;br /&gt;
proc format;&lt;br /&gt;
value yy 0-1=’&amp;lt;=1yr’ 1.5-3=’1-3yr’ 3.5-high=’&amp;gt;3yr’;&lt;br /&gt;
value hh 1-2=’Low’ 3=’Medium’ 4-5=’High’;&lt;br /&gt;
run;&lt;br /&gt;
proc freq;&lt;br /&gt;
tables years*happy/nocol norow nocum nopct;&lt;br /&gt;
format years yy. happy hh.;&lt;br /&gt;
run;&lt;br /&gt;
TABLE OF YEARS BY HAPPY&lt;br /&gt;
YEARS HAPPY&lt;br /&gt;
Frequency|Low |Medium |High | Total&lt;br /&gt;
---------+--------+--------+--------+&lt;br /&gt;
&amp;lt;=1yr | 3 | 3 | 4 | 10&lt;br /&gt;
---------+--------+--------+--------+&lt;br /&gt;
1-3yr | 2 | 2 | 8 | 12&lt;br /&gt;
---------+--------+--------+--------+&lt;br /&gt;
&amp;gt;3yr | 1 | 0 | 2 | 3&lt;br /&gt;
---------+--------+--------+--------+&lt;br /&gt;
Total 6 5 14 25&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;SAS Date and Time Values&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
There are three types of date and time values which SAS can&lt;br /&gt;
handle, shown with their internal representation in parentheses:&lt;br /&gt;
• Time values (number of seconds since midnight)&lt;br /&gt;
• Date values (number of days since January 1, 1970)&lt;br /&gt;
• Datetime values (number of seconds since January 1, 1970)&lt;br /&gt;
You can specify a date and/or time as a constant in a SAS program&lt;br /&gt;
by surrounding the value in quotes, and following it with a t, a d or&lt;br /&gt;
a dt. The following examples show the correct format to use:&lt;br /&gt;
3PM ) ’3:00p’t or ’15:00’t or ’15:00:00’t&lt;br /&gt;
January 4, 1937 ) ’4jan37’d&lt;br /&gt;
9:15AM November 3, 1995 )&lt;br /&gt;
’3nov95:9:15’dt or ’3nov95:9:15:00’dt&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Date and Time Informats and Formats&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
SAS provides three basic informats for reading dates which are&lt;br /&gt;
recorded as all numbers, with or without separators:&lt;br /&gt;
• ddmmyyw. - day, month, year (021102, 6-3-2002, 4/7/2000)&lt;br /&gt;
• mmddyyw. - month, day, year (110202, 3-6-2002, 7/4/2000)&lt;br /&gt;
• yymmddw. - year, month, day (021102, 2002-3-6, 2000/7/4)&lt;br /&gt;
These informats will correctly recognize any of the following&lt;br /&gt;
separators: blank : - . /, as well as no separator.&lt;br /&gt;
For output, the ddmmyyXw., mmddyyXw. and yymmddXw. formats are&lt;br /&gt;
available, where “X” specifies the separator as follows:&lt;br /&gt;
B - blank C - colon(:) D - dash(-)&lt;br /&gt;
N - no separator P - period(.) S - slash(/)&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Other Date and Time Informats and Formats&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Name Width(default) Examples&lt;br /&gt;
datew. 5-9 (7) 26jun96&lt;br /&gt;
datetimew. 7-40 (16) 4JUL96:01:30p&lt;br /&gt;
julianw. 5-7 (5) 96200 1995001&lt;br /&gt;
monyyw. 5-7 (5) jan95 mar1996&lt;br /&gt;
timew. 2-20 (8) 6:00:00 3:15:00p&lt;br /&gt;
The above formats are valid for input and output. In addition, the&lt;br /&gt;
yymmnw. format reads values with only a year and month. The&lt;br /&gt;
nldatew. format/informat provides natural language support for&lt;br /&gt;
written dates (like July 4, 1996), based on the value of the&lt;br /&gt;
locale option. The monnamew. and yearw. formats display parts&lt;br /&gt;
of dates.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;SAS and Y2K&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Since SAS stores its date/time values as the number of seconds or&lt;br /&gt;
days from a fixed starting point, there is no special significance of&lt;br /&gt;
the year 2000 to SAS. But when dates are input to SAS with only&lt;br /&gt;
two digits, there is no way to tell whether they should be&lt;br /&gt;
interpreted as years beginning with 19 or 20. The yearcutoff&lt;br /&gt;
option controls this decision.&lt;br /&gt;
Set the value of this option to the first year of a hundred year span&lt;br /&gt;
to be used to resolve two digit dates. For example, if you use the&lt;br /&gt;
statement&lt;br /&gt;
options yearcutoff=1950;&lt;br /&gt;
then two digit dates will be resolved as being in the range of 1950&lt;br /&gt;
to 2050; i.e. years greater than 50 will be interpreted as beginning&lt;br /&gt;
with 19, and dates less than 50 will be interpreted as beginning&lt;br /&gt;
with 20&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Date and Time Functions&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
datepart – Extract date from datetime value&lt;br /&gt;
dateonly = datepart(fulldate);&lt;br /&gt;
day,month year – Extract part of a date value&lt;br /&gt;
day = day(date);&lt;br /&gt;
dhms – Construct value from date, hour, minute and second&lt;br /&gt;
dtval = dhms(date,9,15,0);&lt;br /&gt;
mdy – Construct date from month, day and year&lt;br /&gt;
date = mdy(mon,day,1996);&lt;br /&gt;
time – Returns the current time of day&lt;br /&gt;
now = time();&lt;br /&gt;
today – Returns the current date&lt;br /&gt;
datenow = today();&lt;br /&gt;
intck – Returns the number of intervals between two values&lt;br /&gt;
days = intck(’day’,then,today());&lt;br /&gt;
intnx – Increments a value by a number of intervals&lt;br /&gt;
tomrw = intnx(’day’,today(),1);&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Application: Blue Moons&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
When there are two full moons in a single month, the second is&lt;br /&gt;
known as a blue moon. Given that July 9, 1998 is a full moon, and&lt;br /&gt;
there are 29 days between full moons, in what months will the next&lt;br /&gt;
few blue moons occur?&lt;br /&gt;
First, we create a data set which has the dates of all the full moons,&lt;br /&gt;
by starting with July 9, 1998, and incrementing the date by 29&lt;br /&gt;
days.&lt;br /&gt;
data fullmoon;&lt;br /&gt;
date = ’09jul98’d;&lt;br /&gt;
do i=1 to 500;&lt;br /&gt;
month = month(date);&lt;br /&gt;
year = year(date);&lt;br /&gt;
output;&lt;br /&gt;
date = intnx(’day’,date,29);&lt;br /&gt;
end;&lt;br /&gt;
run;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Application: Blue Moons (cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Now we can use the put function to create a variable with the full&lt;br /&gt;
month name and the year.&lt;br /&gt;
data bluemoon;&lt;br /&gt;
set fullmoon;&lt;br /&gt;
by year month;&lt;br /&gt;
if last.month and not first.month then do;&lt;br /&gt;
when = put(date,monname.) || &quot;, &quot; || put(date,year.);&lt;br /&gt;
output;&lt;br /&gt;
end;&lt;br /&gt;
run;&lt;br /&gt;
proc print data=bluemoon noobs;&lt;br /&gt;
var when;&lt;br /&gt;
run;&lt;br /&gt;
The results look like this:&lt;br /&gt;
December, 1998&lt;br /&gt;
August, 2000&lt;br /&gt;
May, 2002&lt;br /&gt;
. . .&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Customized Output: put statement&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The put statement is the reverse of the input statement, but in&lt;br /&gt;
addition to variable names, formats and pointer control, you can&lt;br /&gt;
also print text. Most of the features of the input statement work&lt;br /&gt;
in a similar fashion in the put statement. For example, to print a&lt;br /&gt;
message containing the value of of a variable called x, you could use&lt;br /&gt;
a put statement like:&lt;br /&gt;
put ’the value of x is ’ x;&lt;br /&gt;
To print the values of the variables x and y on one line and name&lt;br /&gt;
and address on a second line, you could use:&lt;br /&gt;
put x 8.5 y best10. / name $20 @30 address ;&lt;br /&gt;
Note the use of (optional) formats and pointer control.&lt;br /&gt;
By default, the put statement writes to the SAS log; you can&lt;br /&gt;
override this by specifying a filename or fileref on a file statement.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Additional Features of the put statement&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
By default, the put statement puts a newline after the last item&lt;br /&gt;
processed. To prevent this (for example to build a single line with&lt;br /&gt;
multiple put statements, use a trailing @ at the end of the put&lt;br /&gt;
statement.&lt;br /&gt;
The n* operator repeats a string n times. Thus&lt;br /&gt;
put 80*&quot;-&quot;;&lt;br /&gt;
prints a line full of dashes.&lt;br /&gt;
Following a variable name with an equal sign causes the put&lt;br /&gt;
statement to include the variable’s name in the output. For&lt;br /&gt;
example, the statements&lt;br /&gt;
x = 8;&lt;br /&gt;
put x=;&lt;br /&gt;
results in X=8 being printed to the current output file. The keyword&lt;br /&gt;
all on the put statement prints out the values of all the variables&lt;br /&gt;
in the data set in this named format.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Headers with put statements&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
You can print headings at the top of each page by specifying a&lt;br /&gt;
header= specification on the file statement with the label of a set&lt;br /&gt;
of statements to be executed. For example, to print a table&lt;br /&gt;
containing names and addresses, with column headings at the top&lt;br /&gt;
of each page, you could use statements like the following:&lt;br /&gt;
options ps=50;&lt;br /&gt;
data _null_;&lt;br /&gt;
set address;&lt;br /&gt;
file &quot;output&quot; header = top print;&lt;br /&gt;
put @1 name $20. @25 address $30.;&lt;br /&gt;
return;&lt;br /&gt;
top:&lt;br /&gt;
put @1 ’Name’ @25 ’Address’ / @1 20*’-’ @25 30*’-’;&lt;br /&gt;
return;&lt;br /&gt;
run;&lt;br /&gt;
Note the use of the two return statements. The print option is&lt;br /&gt;
required when using the header= option on the file statement.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Output Delivery System (ODS)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
To provide more flexibility in producing output from SAS data&lt;br /&gt;
steps and procedures, SAS introduced the ODS. Using ODS, output&lt;br /&gt;
can be produced in any of the following formats (the parenthesized&lt;br /&gt;
keyword is used to activate a particular ODS stream):&lt;br /&gt;
• SAS data set (OUTPUT)&lt;br /&gt;
• Normal listing (LISTING) - monospaced font&lt;br /&gt;
• Postscript output (PRINTER) - proportional font&lt;br /&gt;
• PDF output (PDF) - Portable Document Format&lt;br /&gt;
• HTML output (HTML) - for web pages&lt;br /&gt;
• RTF output (RTF) - for inclusion in word processors&lt;br /&gt;
Many procedures produce ODS objects, which can then be output&lt;br /&gt;
in any of these formats. In addition, the ods option of the file&lt;br /&gt;
statement, and the ods option of the put statement allow you to&lt;br /&gt;
customize ODS output.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;ODS Destinations&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
You can open an ODS output stream with the ODS command and a&lt;br /&gt;
destination keyword. For example, to produce HTML formatted&lt;br /&gt;
output from the print procedure:&lt;br /&gt;
ods html file=&quot;output.html&quot;;&lt;br /&gt;
proc print data=mydata;&lt;br /&gt;
run;&lt;br /&gt;
ods html close;&lt;br /&gt;
Using the print and ods options of the file statement, you can&lt;br /&gt;
customize ODS output:&lt;br /&gt;
ods printer;&lt;br /&gt;
data _null_;&lt;br /&gt;
file print ods;&lt;br /&gt;
... various put statements ...&lt;br /&gt;
run;&lt;br /&gt;
ods printer close;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;SAS System Options&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
SAS provides a large number of options for fine tuning the way the&lt;br /&gt;
program behaves. Many of these are system dependent, and are&lt;br /&gt;
documented online and/or in the appropriate SAS Companion.&lt;br /&gt;
You can specify options in three ways:&lt;br /&gt;
1. On the command line when invoking SAS, for example&lt;br /&gt;
sas -nocenter -nodms -pagesize 20&lt;br /&gt;
2. In the system wide config.sas file, or in a local config.sas&lt;br /&gt;
file (see the SAS Companion for details).&lt;br /&gt;
3. Using the options statement:&lt;br /&gt;
options nocenter pagesize=20;&lt;br /&gt;
Note that you can precede the name of options which do not take&lt;br /&gt;
arguments with no to shut off the option. You can display the&lt;br /&gt;
value of all the current options by running proc options.&lt;br /&gt;


&lt;br /&gt;


&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/6985808820528031667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2013/11/review-introduction-to-sas-system-part-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/6985808820528031667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/6985808820528031667'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2013/11/review-introduction-to-sas-system-part-3.html' title='Review: An Introduction to the SAS System Part-3'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-8823590938778501548</id><published>2013-11-22T00:35:00.003+05:30</published><updated>2013-11-22T00:35:30.345+05:30</updated><title type='text'>Review: An Introduction to the SAS System Part-2</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:DocumentProperties&gt;
  &lt;o:Version&gt;12.00&lt;/o:Version&gt;
 &lt;/o:DocumentProperties&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;br /&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:DontVertAlignCellWithSp/&gt;
   &lt;w:DontBreakConstrainedForcedTables/&gt;
   &lt;w:DontVertAlignInTxbx/&gt;
   &lt;w:Word11KerningPairs/&gt;
   &lt;w:CachedColBalance/&gt;
   &lt;w:UseFELayout/&gt;
  &lt;/w:Compatibility&gt;
  &lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val=&quot;Cambria Math&quot;/&gt;
   &lt;m:brkBin m:val=&quot;before&quot;/&gt;
   &lt;m:brkBinSub m:val=&quot;--&quot;/&gt;
   &lt;m:smallFrac m:val=&quot;off&quot;/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val=&quot;0&quot;/&gt;
   &lt;m:rMargin m:val=&quot;0&quot;/&gt;
   &lt;m:defJc m:val=&quot;centerGroup&quot;/&gt;
   &lt;m:wrapIndent m:val=&quot;1440&quot;/&gt;
   &lt;m:intLim m:val=&quot;subSup&quot;/&gt;
   &lt;m:naryLim m:val=&quot;undOvr&quot;/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState=&quot;false&quot; DefUnhideWhenUsed=&quot;true&quot;
  DefSemiHidden=&quot;true&quot; DefQFormat=&quot;false&quot; DefPriority=&quot;99&quot;
  LatentStyleCount=&quot;267&quot;&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;0&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Normal&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;heading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;35&quot; QFormat=&quot;true&quot; Name=&quot;caption&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;10&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; Name=&quot;Default Paragraph Font&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;11&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtitle&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;22&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Strong&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;20&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;59&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Table Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Placeholder Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;No Spacing&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Revision&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;34&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;List Paragraph&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;29&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;30&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;19&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;21&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;31&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;32&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;33&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Book Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;37&quot; Name=&quot;Bibliography&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; QFormat=&quot;true&quot; Name=&quot;TOC Heading&quot;/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:&quot;Table Normal&quot;;
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-priority:99;
 mso-style-qformat:yes;
 mso-style-parent:&quot;&quot;;
 mso-padding-alt:0in 5.4pt 0in 5.4pt;
 mso-para-margin-top:0in;
 mso-para-margin-right:0in;
 mso-para-margin-bottom:10.0pt;
 mso-para-margin-left:0in;
 line-height:115%;
 mso-pagination:widow-orphan;
 font-size:11.0pt;
 font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
 mso-ascii-font-family:Calibri;
 mso-ascii-theme-font:minor-latin;
 mso-hansi-font-family:Calibri;
 mso-hansi-theme-font:minor-latin;
 mso-bidi-font-family:&quot;Times New Roman&quot;;
 mso-bidi-theme-font:minor-bidi;}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Some Common Options&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Option Argument Description&lt;br /&gt;
Options which are useful when invoking SAS&lt;br /&gt;
dms - Use display manager windows&lt;br /&gt;
stdio - Obey UNIX standard input and output&lt;br /&gt;
config filename Use filename as configuration file&lt;br /&gt;
Options which control output appearance&lt;br /&gt;
center - Center output on the page&lt;br /&gt;
date - Include today’s date on each page&lt;br /&gt;
number - Include page numbers on output&lt;br /&gt;
linesize number Print in a width of number columns&lt;br /&gt;
pagesize number Go to a new page after number lines&lt;br /&gt;
ovp - Show emphasis by overprinting&lt;br /&gt;
Options which control data set processing&lt;br /&gt;
obs number Process a maximum of number obs.&lt;br /&gt;
firstobs number Skip first number observations&lt;br /&gt;
replace - Replace permanent data sets?&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Application: Rescanning Input&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Suppose we have an input file which has a county name on one line&lt;br /&gt;
followed by one or more lines containing x and y coordinates of the&lt;br /&gt;
boundaries of the county. We wish to create a separate observation,&lt;br /&gt;
including the county name, for each set of coordinates.&lt;br /&gt;
A segment of the file might look like this:&lt;br /&gt;
alameda&lt;br /&gt;
-121.55 37.82 -121.55 37.78 -121.55 37.54 -121.50 37.53&lt;br /&gt;
-121.49 37.51 -121.48 37.48&lt;br /&gt;
amador&lt;br /&gt;
-121.55 37.82 -121.59 37.81 -121.98 37.71 -121.99 37.76&lt;br /&gt;
-122.05 37.79 -122.12 37.79 -122.13 37.82 -122.18 37.82&lt;br /&gt;
-122.20 37.87 -122.25 37.89 -122.27 37.90&lt;br /&gt;
calaveras&lt;br /&gt;
-121.95 37.48 -121.95 37.48 -121.95 37.49 -122.00 37.51&lt;br /&gt;
-122.05 37.53 -122.07 37.55 -122.09 37.59 -122.11 37.65&lt;br /&gt;
-122.14 37.70 -122.19 37.74 -122.24 37.76 -122.27 37.79&lt;br /&gt;
-122.27 37.83 -122.27 37.85 -122.27 37.87 -122.27 37.90&lt;br /&gt;
. . .&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Application: Rescanning Input (cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Note that we don’t know how many observations (or data lines)&lt;br /&gt;
belong to each county.&lt;br /&gt;
data counties;&lt;br /&gt;
length county $ 12 name $ 12;&lt;br /&gt;
infile &quot;counties.dat&quot;;&lt;br /&gt;
retain county;&lt;br /&gt;
input name $ @; * hold current line for rescanning;&lt;br /&gt;
if indexc(name,’0123456789’) = 0 then do;&lt;br /&gt;
county = name;&lt;br /&gt;
delete; * save county name, but don’t output;&lt;br /&gt;
end;&lt;br /&gt;
else do;&lt;br /&gt;
x = input(name,12.) * do numeric conversion;&lt;br /&gt;
input y @@; * hold the line to read more x/y pairs;&lt;br /&gt;
end;&lt;br /&gt;
drop name;&lt;br /&gt;
run;&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Application: Reshaping a Data Set I&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Since SAS procedures are fairly rigid about the organization of&lt;br /&gt;
their input, it is often necessary to use the data step to change the&lt;br /&gt;
shape of a data set. For example, repeated measurements on a&lt;br /&gt;
single subject may be on several observations, and we may want&lt;br /&gt;
them all on the same observation. In essence, we want to perform&lt;br /&gt;
the following transformation:&lt;br /&gt;
Subj Time X&lt;br /&gt;
1 1 10&lt;br /&gt;
1 2 12&lt;br /&gt;
· · · Subj X1 X2 · · · Xn&lt;br /&gt;
1 n 8 =) 1 10 12 · · · 8&lt;br /&gt;
2 1 19 2 19 7 · · · 21&lt;br /&gt;
2 2 7&lt;br /&gt;
· · ·&lt;br /&gt;
2 n 21&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Application: Reshaping a Data Set
I(cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Since we will be processing multiple input observations to produce&lt;br /&gt;
a single output observation, a retain statement must be used to&lt;br /&gt;
remember the values from previous inputs. The combination of a&lt;br /&gt;
by statement and first. and last. variables allows us to create&lt;br /&gt;
the output observations at the appropriate time, even if there are&lt;br /&gt;
incomplete records.&lt;br /&gt;
data two;&lt;br /&gt;
set one;&lt;br /&gt;
by subj;&lt;br /&gt;
array xx x1-xn;&lt;br /&gt;
retain x1-xn;&lt;br /&gt;
if first.subj then do i=1 to dim(xx); xx{i} = .;end;&lt;br /&gt;
xx{time} = x;&lt;br /&gt;
if last.subj then output;&lt;br /&gt;
drop time x;&lt;br /&gt;
run;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Application: Reshaping a Data Set II&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
A similar problem to the last is the case where the data for several&lt;br /&gt;
observations is contained on a single line, and it is necessary to&lt;br /&gt;
convert each of the lines of input into several observations. Suppose&lt;br /&gt;
we have test scores for three different tests, for each of several&lt;br /&gt;
subjects; we wish to create three separate observations from each of&lt;br /&gt;
these sets of test scores:&lt;br /&gt;
data scores;&lt;br /&gt;
* assume set three contains id, group and score1-score3;&lt;br /&gt;
set three;&lt;br /&gt;
array sss score1-score3;&lt;br /&gt;
do time = 1 to dim(sss);&lt;br /&gt;
score = sss{time};&lt;br /&gt;
output;&lt;br /&gt;
end;&lt;br /&gt;
drop score1-score3;&lt;br /&gt;
run;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Output Data Sets&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Many SAS procedures produce output data sets containing data&lt;br /&gt;
summaries (means, summary, univariate), information about&lt;br /&gt;
statistical analyses (reg, glm, nlin, tree) or transformed variables&lt;br /&gt;
(standard, score, cancorr, rank); some procedures can produce&lt;br /&gt;
multiple output data sets. These data sets can be manipulated just&lt;br /&gt;
like any other SAS data sets.&lt;br /&gt;
Recall that the statistical functions like mean() and std() can&lt;br /&gt;
calculate statistical summaries for variables within an observation;&lt;br /&gt;
output data sets are used to calculate summaries of variables over&lt;br /&gt;
the whole data set.&lt;br /&gt;
When you find that you are looping through an entire data set to&lt;br /&gt;
calculate a single quantity which you then pass on to another data&lt;br /&gt;
step, consider using an output data set instead.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Using ODS to create data sets&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Many procedures use the output delivery system to provide&lt;br /&gt;
additional control over the output data sets that they produce. To&lt;br /&gt;
find out if ODS tables are available for a particular procedure, use&lt;br /&gt;
the following statement before the procedure of interest:&lt;br /&gt;
ods trace on;&lt;br /&gt;
Each table will produce output similar to the following on the log:&lt;br /&gt;
Output Added:&lt;br /&gt;
-------------&lt;br /&gt;
Name: ExtremeObs&lt;br /&gt;
Label: Extreme Observations&lt;br /&gt;
Template: base.univariate.ExtObs&lt;br /&gt;
Path: Univariate.x.ExtremeObs&lt;br /&gt;
-------------&lt;br /&gt;
Once the path of a table of interest is located, you can produce a&lt;br /&gt;
data set with the ods output statement, specifying the path with&lt;br /&gt;
an equal sign followed by the output data set name.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;ODS Output Data Set: Example&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The univariate procedure provides printed information about&lt;br /&gt;
extreme observations, but this information is not available through&lt;br /&gt;
the out= data set. To put this information in a data set, first find&lt;br /&gt;
the appropriate path by using the ods trace statement, and then&lt;br /&gt;
use an ODS statement like the following:&lt;br /&gt;
ods output Univariate.x.ExtremeObs=extreme;&lt;br /&gt;
proc univariate data=mydata;&lt;br /&gt;
var x;&lt;br /&gt;
run;&lt;br /&gt;
ods output close;&lt;br /&gt;
The data set extreme will now contain information about the&lt;br /&gt;
extreme values.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Output Data Sets: Example I&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
It is often useful to have summary information about a data set&lt;br /&gt;
available when the data set is being processed. Suppose we have a&lt;br /&gt;
data set called new, with a variable x, and we wish to calculate a&lt;br /&gt;
variable px equal to x divided by the maximum value of x.&lt;br /&gt;
proc summary data=new;&lt;br /&gt;
var x;&lt;br /&gt;
output out=sumnew max=maxx;&lt;br /&gt;
run;&lt;br /&gt;
data final;&lt;br /&gt;
if _n_ = 1 then set sumnew(keep=maxx);&lt;br /&gt;
set new;&lt;br /&gt;
px = x / maxx;&lt;br /&gt;
run;&lt;br /&gt;
The automatic variable n will be 1 for the first observation only;&lt;br /&gt;
the single observation in sumnew gets read at this time. The set&lt;br /&gt;
new; statement then reads in the original data.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Output Data Sets: Example II&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Now suppose we have two classification variables called group and&lt;br /&gt;
trtmnt, and we wish to use the maximum value for each&lt;br /&gt;
group/trtmnt combination in the transformation. If the data set&lt;br /&gt;
had already been sorted, the following statements could be used:&lt;br /&gt;
proc summary nway data=new;&lt;br /&gt;
class group trtmnt;&lt;br /&gt;
var x;&lt;br /&gt;
output out=sumnew max=maxx;&lt;br /&gt;
run;&lt;br /&gt;
data final;&lt;br /&gt;
merge new sumnew(keep=maxx);&lt;br /&gt;
by group trtmnt;&lt;br /&gt;
px = x / maxx;&lt;br /&gt;
run;&lt;br /&gt;
The nway option limits the output data set to contain observations&lt;br /&gt;
for each unique combination of the variables given in the class&lt;br /&gt;
statement.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Output Data Sets: Example III&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Suppose we have a data set called hdata, consisting of three&lt;br /&gt;
variables: hospital, time and score, representing the score of&lt;br /&gt;
some medical exam taken at three different times at three different&lt;br /&gt;
hospitals, and we’d like to produce a plot with three lines: one for&lt;br /&gt;
the means of each of the three hospitals over time. The following&lt;br /&gt;
statements could be used:&lt;br /&gt;
proc means noprint nway data=hdata;&lt;br /&gt;
class hospital time;&lt;br /&gt;
var score;&lt;br /&gt;
output out=hmeans mean=mscore;&lt;br /&gt;
run;&lt;br /&gt;
The noprint option suppresses the usual printing which is the&lt;br /&gt;
default for proc means. You could acheive similar results using a&lt;br /&gt;
by statement instead of a class statement, but the data set would&lt;br /&gt;
need to be sorted.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Output Data Sets: Example III(cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The transformation which the previous program produced can be&lt;br /&gt;
thought of as the following:&lt;br /&gt;
hospital time score&lt;br /&gt;
mercy 1 132&lt;br /&gt;
mercy 2 125&lt;br /&gt;
. . . hospital time _type_ _freq_ mscore&lt;br /&gt;
mercy 1 144 city 1 3 2 146.500&lt;br /&gt;
mercy 2 224 city 2 3 2 120.000&lt;br /&gt;
county 1 119 city 3 3 2 128.000&lt;br /&gt;
county 2 125 =) county 1 3 2 125.500&lt;br /&gt;
. . . county 2 3 2 127.000&lt;br /&gt;
county 2 129 county 3 3 2 117.000&lt;br /&gt;
county 3 113 mercy 1 3 3 131.667&lt;br /&gt;
city 1 144 mercy 2 3 2 174.500&lt;br /&gt;
city 2 121 mercy 3 3 1 121.000&lt;br /&gt;
. . .&lt;br /&gt;
city 1 149&lt;br /&gt;
city 3 122&lt;br /&gt;
The type variable indicates the observations are for a unique&lt;br /&gt;
combination of levels of two class variables, while the freq&lt;br /&gt;
variable is the number of observations which were used for the&lt;br /&gt;
computation of that statistic.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Plotting the Means&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The following program produces the graph shown on the right:&lt;br /&gt;
symbol1 interpol=join&lt;br /&gt;
value=plus;&lt;br /&gt;
symbol2 interpol=join&lt;br /&gt;
value=square;&lt;br /&gt;
symbol3 interpol=join&lt;br /&gt;
value=star;&lt;br /&gt;
title &quot;Means versus Time&quot;;&lt;br /&gt;
proc gplot data=hmeans;&lt;br /&gt;
plot mscore*time=hospital;&lt;br /&gt;
run;&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Application: Finding Duplicate
Observations II&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
In a previous example, duplicates were found by using by&lt;br /&gt;
processing and first. and last. variables. If the data set were&lt;br /&gt;
very large, or not already sorted by id, that program would not be&lt;br /&gt;
very efficient. In this case, an output data set from proc freq&lt;br /&gt;
might be more useful. Once again, assume the identifier variable is&lt;br /&gt;
called id. The following statements will produce a data set with&lt;br /&gt;
the id values of the duplicate observations.&lt;br /&gt;
proc freq data=old noprint;&lt;br /&gt;
tables id/ out=counts(rename = (count = n) keep=id count);&lt;br /&gt;
run;&lt;br /&gt;
data check;&lt;br /&gt;
set counts;&lt;br /&gt;
if n &amp;gt; 1;&lt;br /&gt;
run;&lt;br /&gt;
Note that, even though count is renamed to n, the original variable&lt;br /&gt;
name (count) is used on the keep statement.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;SAS Macro Language: Overview&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
At it’s simplest level, the SAS Macro language allows you to assign&lt;br /&gt;
a string value to a variable and to use the variable anywhere in a&lt;br /&gt;
SAS program:&lt;br /&gt;
%let header = &quot;Here is my title&quot;;&lt;br /&gt;
. . .&lt;br /&gt;
proc print ;&lt;br /&gt;
var x y z;&lt;br /&gt;
title &amp;amp;header;&lt;br /&gt;
run;&lt;br /&gt;
This would produce exactly the same result as if you typed the&lt;br /&gt;
string &quot;Here is my title&quot; in place of &amp;amp;header in the program.&lt;br /&gt;
Notice that the substitution is very simple - the text of the macro&lt;br /&gt;
variable is substituted for the macro symbol in the program.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;SAS Macro Language: Overview (cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The macro facility can be used to replace pieces of actual programs&lt;br /&gt;
by creating named macros:&lt;br /&gt;
%macro readsome;&lt;br /&gt;
data one;&lt;br /&gt;
infile &quot;myfile&quot;;&lt;br /&gt;
input x y z;&lt;br /&gt;
if&lt;br /&gt;
%mend;&lt;br /&gt;
%readsome x &amp;gt; 1; run;&lt;br /&gt;
The final statement is equivalent to typing&lt;br /&gt;
data one;&lt;br /&gt;
infile &quot;myfile&quot;;&lt;br /&gt;
input x y z;&lt;br /&gt;
if x &amp;gt; 1; run;&lt;br /&gt;
Once again, all that is performed is simple text replacement.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;SAS Macro Language: Overview (cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
A large part of the macro facility’s utility comes from the macro&lt;br /&gt;
programming statements which are all preceded by a percent sign&lt;br /&gt;
(%). For example, suppose we need to create 5 data sets, named&lt;br /&gt;
sales1, sales2, etc., each reading from a corresponding data file&lt;br /&gt;
insales1, insales2, etc.&lt;br /&gt;
%macro dosales;&lt;br /&gt;
%do i=1 %to 5;&lt;br /&gt;
data sales&amp;amp;i;&lt;br /&gt;
infile &quot;insales&amp;amp;i&quot;;&lt;br /&gt;
input dept $ sales;&lt;br /&gt;
run;&lt;br /&gt;
%end;&lt;br /&gt;
%mend dosales;&lt;br /&gt;
%dosales;&lt;br /&gt;
Note that, until the last line is entered, no actual SAS statements&lt;br /&gt;
are carried out; the macro is only compiled.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Defining and Accessing Macro Variables in
the Data Step&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
You can set a macro variable to a value in the data step using the&lt;br /&gt;
call symput function. The format is&lt;br /&gt;
call symput(name,value);&lt;br /&gt;
where name is a string or character variable containing the name of&lt;br /&gt;
the macro variable to be created, and value is the value the macro&lt;br /&gt;
variable will have.&lt;br /&gt;
To access a macro variable in a data step, you can use the symget&lt;br /&gt;
function.&lt;br /&gt;
value = symget(name);&lt;br /&gt;
name is a string or character variable containing the name of the&lt;br /&gt;
macro variable to be accessed.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;call symput: Example&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Suppose we want to put the maximum value of a variable in a title.&lt;br /&gt;
The following program shows how.&lt;br /&gt;
data new;&lt;br /&gt;
retain max -1e20;&lt;br /&gt;
set salary end = last;&lt;br /&gt;
if salary &amp;gt; max then max = salary;&lt;br /&gt;
if last then call symput(&quot;maxsal&quot;,max);&lt;br /&gt;
drop max;&lt;br /&gt;
run;&lt;br /&gt;
title &quot;Salaries of employees (Maximum = &amp;amp;maxsal)&quot;;&lt;br /&gt;
proc print data=salary;&lt;br /&gt;
run;&lt;br /&gt;
Note that no ampersand is used in call symput, but you must use&lt;br /&gt;
an ampersand to reference the macro variable later in your&lt;br /&gt;
program.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;An Alternative to the macro facility&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
As an alternative to the previous example, we can use the put&lt;br /&gt;
statement to write a SAS program, and then use the %include&lt;br /&gt;
statement to execute the program. Using this technique, the&lt;br /&gt;
following statements recreate the previous example:&lt;br /&gt;
proc means data=salary noprint;&lt;br /&gt;
var salary;&lt;br /&gt;
output out=next max=maxsal;&lt;br /&gt;
data _null_;&lt;br /&gt;
set next;&lt;br /&gt;
file &quot;tmpprog.sas&quot;;&lt;br /&gt;
put ’title &quot;Salaries of employees (Maximum =’ maxsal ’)&quot;;’;&lt;br /&gt;
put ’proc print data=salary;’;&lt;br /&gt;
put ’run;’;&lt;br /&gt;
run;&lt;br /&gt;
%include &quot;tmpprog.sas&quot;;&lt;br /&gt;
Pay special attention to quotes and semicolons in the generated&lt;br /&gt;
program.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Another Alternative to the Macro Facility&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
In addition to writing SAS statements to a file, SAS provides the&lt;br /&gt;
call execute function. This function takes a quoted string, a&lt;br /&gt;
character variable, or a SAS expression which resolves to a&lt;br /&gt;
character variable and then executes its input when the current&lt;br /&gt;
data step is completed.&lt;br /&gt;
For example, suppose we have a data set called new which contains&lt;br /&gt;
a variable called maxsal. We could generate a title statement&lt;br /&gt;
containing this value with statements like the following.&lt;br /&gt;
data _null_;&lt;br /&gt;
set new;&lt;br /&gt;
call execute(’title&lt;br /&gt;
&quot;Salaries of employees (Maximum = ’|| put(maxsal,6.) || ’)&quot;;’);&lt;br /&gt;
run;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;call execute Example&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
As a larger example of the use of the call execute function,&lt;br /&gt;
consider the problem of reading a list of filenames from a SAS data&lt;br /&gt;
set and constructing the corresponding data steps to read the files.&lt;br /&gt;
The following program performs the same function as the earlier&lt;br /&gt;
macro example.&lt;br /&gt;
data _null_;&lt;br /&gt;
set files;&lt;br /&gt;
call execute(’data ’ || name || ’;’);&lt;br /&gt;
call execute(’infile &quot;’|| trim(name) || ’&quot;;’);&lt;br /&gt;
call execute(’input x y;’);&lt;br /&gt;
call execute(’run;’);&lt;br /&gt;
run;&lt;br /&gt;
Be careful with single and double quotes, and make sure the&lt;br /&gt;
generated statements follow the rules of SAS syntax.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Application: Reading a Series of Files&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Suppose we have a data set containing the names of files to be read,&lt;br /&gt;
and we wish to create data sets of the same name from the data in&lt;br /&gt;
those files. First, we use the call symput function in the data step&lt;br /&gt;
to create a series of macro variables containing the file names&lt;br /&gt;
data _null_;&lt;br /&gt;
set files end=last;&lt;br /&gt;
n + 1;&lt;br /&gt;
call symput(&quot;file&quot;||left(n),trim(name));&lt;br /&gt;
if last then call symput(&quot;num&quot;,n);&lt;br /&gt;
run;&lt;br /&gt;
Since macros work by simple text substitution, it is important that&lt;br /&gt;
there are no blanks in either the macro name or value, thus the use&lt;br /&gt;
of left and trim&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Application: Reading a Series of Files
(cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Now we can write a macro to loop over the previously defined file&lt;br /&gt;
names and create the data sets.&lt;br /&gt;
%macro readem;&lt;br /&gt;
%do i=1 %to &amp;amp;num;&lt;br /&gt;
data &amp;amp;&amp;amp;file&amp;amp;i;&lt;br /&gt;
infile &quot;&amp;amp;&amp;amp;file&amp;amp;i&quot;;&lt;br /&gt;
input x y;&lt;br /&gt;
run;&lt;br /&gt;
%end;&lt;br /&gt;
%mend;&lt;br /&gt;
%readem;&lt;br /&gt;
Notice that the macro variable is refered to as &amp;amp;&amp;amp;file&amp;amp;i, to force&lt;br /&gt;
the macro substitution to be scanned twice. If we used just a single&lt;br /&gt;
ampersand, SAS would look for a macro variable called &amp;amp;file.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Macros with Arguments&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Consider the following program to print duplicate cases with&lt;br /&gt;
common values of the variables a and b in data set one:&lt;br /&gt;
data one;&lt;br /&gt;
input a b y @@;&lt;br /&gt;
datalines;&lt;br /&gt;
1 1 12 1 1 14 1 2 15 1 2 19 1 3 15 2 1 19 2 4 16 2 4 12 2 8 18 3 1 19&lt;br /&gt;
proc summary data=one nway ;&lt;br /&gt;
class a b;&lt;br /&gt;
output out=next(keep = a b _freq_ rename=(_freq_ = count));&lt;br /&gt;
data dups;&lt;br /&gt;
merge one next;&lt;br /&gt;
by a b;&lt;br /&gt;
if count &amp;gt; 1;&lt;br /&gt;
proc print data=dups;&lt;br /&gt;
run;&lt;br /&gt;
If we had simple way of changing the input data set name and the&lt;br /&gt;
list of variables on the by statement, we could write a general&lt;br /&gt;
macro for printing duplicates in a data set.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Macros with Arguments (cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
To add arguments to a macro, simply replace the parts of the&lt;br /&gt;
program in question with macro variables (beginning with &amp;amp;), and&lt;br /&gt;
list the variables in the argument list (without the &amp;amp;).&lt;br /&gt;
%macro prntdups(data,by);&lt;br /&gt;
proc summary data=&amp;amp;data nway ;&lt;br /&gt;
class &amp;amp;by;&lt;br /&gt;
output out=next(keep = &amp;amp;by _freq_ rename=(_freq_ = count));&lt;br /&gt;
run;&lt;br /&gt;
data dups;&lt;br /&gt;
merge &amp;amp;data next;&lt;br /&gt;
by &amp;amp;by;&lt;br /&gt;
if count &amp;gt; 1;&lt;br /&gt;
run;&lt;br /&gt;
proc print data=dups;&lt;br /&gt;
run;&lt;br /&gt;
%mend prntdups;&lt;br /&gt;
Then the program on the previous slide would be replaced by:&lt;br /&gt;
%prntdups(one,a b);&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Accessing Operating System Commands&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
If you need to run an operating system command from inside a&lt;br /&gt;
SAS program, you can use the x command. Enclose the command&lt;br /&gt;
in quotes after the x, and end the statement with a semicolon. The&lt;br /&gt;
command will be executed as soon as it is encountered.&lt;br /&gt;
For example, in an earlier program, a file called tmpprog.sas was&lt;br /&gt;
created to hold program statements which were later executed. To&lt;br /&gt;
remove the file after the statements were executed (on a UNIX&lt;br /&gt;
system) you could use the SAS statement:&lt;br /&gt;
x ’rm tmpprog.sas’;&lt;br /&gt;
Other interfaces to the operating system may be available. For&lt;br /&gt;
example, on UNIX systems the pipe keyword can be used on a&lt;br /&gt;
filename statement to have SAS read from or write to a process&lt;br /&gt;
instead of a file. See the SAS Companion for your operating system&lt;br /&gt;
for more details.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Transporting Data Sets&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
It is sometimes necessary to move a SAS data set from one&lt;br /&gt;
computer to another. The internal format of SAS data sets is not&lt;br /&gt;
the same on all computers, so to make it possible to transfer data&lt;br /&gt;
sets from one computer to another, SAS provides what is known as&lt;br /&gt;
a transport format. Whenever you move a SAS data set from one&lt;br /&gt;
computer to another, you must first convert it into transport&lt;br /&gt;
format.&lt;br /&gt;
Keep in mind that SAS data sets are in general readable only by&lt;br /&gt;
SAS. Thus, an alternative (or perhaps a backup) method for&lt;br /&gt;
transporting data sets is to write them in a human-readable way,&lt;br /&gt;
using, for example, put statements. Human-readable files can be&lt;br /&gt;
processed by SAS (or some other program), and are generally easier&lt;br /&gt;
to move around than SAS transport data sets.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;SAS/CONNECT&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
SAS also provides a product called SAS/CONNECT which lets you&lt;br /&gt;
initiate a SAS job on a remote computer from a local SAS display&lt;br /&gt;
manager session. It also provides two procedures, proc upload and&lt;br /&gt;
proc download to simplify transporting data sets. If&lt;br /&gt;
SAS/CONNECT is available on the machines between which the&lt;br /&gt;
data set needs to be moved, it may be the easiest way to move the&lt;br /&gt;
data set.&lt;br /&gt;
SAS/CONNECT must be run from the display manager. When&lt;br /&gt;
you connect with the other system, you will be prompted for a&lt;br /&gt;
login name and a password (if appropriate). Once you’re&lt;br /&gt;
connected, the rsubmit display manager command will submit jobs&lt;br /&gt;
to the remote host, even though the log and output will be&lt;br /&gt;
managed by the local host.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Creating a Dataset in transport format&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
proc copy can be used to create a transport format file, but the&lt;br /&gt;
critical step is to use the xport keyword in the libname statement.&lt;br /&gt;
The specified libname is then the name of the transport format file&lt;br /&gt;
which SAS will create, not a directory as is usually the case.&lt;br /&gt;
Suppose we wanted to create a SAS transport data file named&lt;br /&gt;
move.survey from a SAS data set named save.results.&lt;br /&gt;
libname save &quot;/my/sas/dir&quot;;&lt;br /&gt;
libname move xport &quot;move.survey&quot;;&lt;br /&gt;
proc copy in=save out=move;&lt;br /&gt;
select results;&lt;br /&gt;
run;&lt;br /&gt;
If you transfer the transport data set using a program like ftp,&lt;br /&gt;
make sure that you use binary (image) mode to transfer&lt;br /&gt;
the file.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;proc transpose&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Occasionally it is useful to switch the roles of variables and&lt;br /&gt;
observations in a data set. The proc transpose program takes&lt;br /&gt;
care of this task.&lt;br /&gt;
To understand the workings of proc transpose, consider a data&lt;br /&gt;
set with four observations and three variables (x, y and z). Here’s&lt;br /&gt;
the transformation proc transpose performs:&lt;br /&gt;
Original data Transposed data&lt;br /&gt;
X Y Z _NAME_ COL1 COL2 COL3 COL4&lt;br /&gt;
12 19 14 X 12 21 33 14&lt;br /&gt;
21 15 19 =) Y 19 15 27 32&lt;br /&gt;
33 27 82 Z 14 19 82 99&lt;br /&gt;
14 32 99&lt;br /&gt;
The real power of proc transpose becomes apparent when it’s&lt;br /&gt;
used with a by statement.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;proc transpose with a by statement&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
When a by statement is used with proc transpose, a variety of&lt;br /&gt;
manipulations which normally require programming can be&lt;br /&gt;
acheived automatically.&lt;br /&gt;
For example, consider a data set with several observations for each&lt;br /&gt;
subject, similar to a previous example:&lt;br /&gt;
subj time x&lt;br /&gt;
1 1 12&lt;br /&gt;
1 2 15&lt;br /&gt;
1 3 19&lt;br /&gt;
2 1 17&lt;br /&gt;
2 3 14&lt;br /&gt;
3 1 21&lt;br /&gt;
3 2 15&lt;br /&gt;
3 3 18&lt;br /&gt;
Notice that there is no observation for subject 2 at time 2.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;proc transpose with a by statement
(cont’d)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
To make sure proc transpose understands the structure that we&lt;br /&gt;
want in the output data set, an id statement is used to specify&lt;br /&gt;
time as the variable which defines the new variables being created.&lt;br /&gt;
The prefix= option controls the name of the new variables:&lt;br /&gt;
proc transpose data=one out=two prefix=value;&lt;br /&gt;
by subj;&lt;br /&gt;
id time;&lt;br /&gt;
The results are shown below:&lt;br /&gt;
subj _NAME_ value1 value2 value3&lt;br /&gt;
1 x 12 15 19&lt;br /&gt;
2 x 17 . 14&lt;br /&gt;
3 x 21 15 18&lt;br /&gt;
Notice that the missing value for subject 2, time 2 was handled&lt;br /&gt;
correctly.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;proc contents&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Since SAS data sets cannot be read like normal files, it is important&lt;br /&gt;
to have tools which provide information about data sets. proc&lt;br /&gt;
print can show what’s in a data set, but it not always be&lt;br /&gt;
appropriate. The var and libname windows of the display manager&lt;br /&gt;
are other useful tools, but to get printed information or to&lt;br /&gt;
manipulate that information, you should use proc contents.&lt;br /&gt;
Among other information, proc contents provides the name,&lt;br /&gt;
type, length, format, informat and label for each variable in the&lt;br /&gt;
data set, as well as the creation date and time and the number of&lt;br /&gt;
observations. To use proc contents, specify the data set name as&lt;br /&gt;
the data= argument of the proc contents statement; to see the&lt;br /&gt;
contents of all the data sets in a directory, define an appropriate&lt;br /&gt;
libname for the directory, and provide a data set name of the form&lt;br /&gt;
libname. all .&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Options for proc contents&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The short option limits the output to just a list of variable names.&lt;br /&gt;
The position option orders the variables by their position in the&lt;br /&gt;
data set, instead of the default alphabetical order. This can be&lt;br /&gt;
useful when working with double dashed lists.&lt;br /&gt;
The directory option provides a list of all the data sets in the&lt;br /&gt;
library that the specified data set comes from, along with the usual&lt;br /&gt;
output for the specified data set.&lt;br /&gt;
The nods option, when used in conjunction with a data set of the&lt;br /&gt;
form libname. all , limits the output to a list of the data sets in&lt;br /&gt;
the specified libname, with no output for the individual data sets.&lt;br /&gt;
The out= option specifies the name of an output data set to&lt;br /&gt;
contain the information about the variables in the specified data&lt;br /&gt;
set(s). The program on the next slide uses this data set to write a&lt;br /&gt;
human readable version of a SAS data set.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Using the output data set from proc
contents&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
%macro putdat(indata,outfile);&lt;br /&gt;
proc contents noprint data=&amp;amp;indata out=fcon; run;&lt;br /&gt;
data _null_;&lt;br /&gt;
file &quot;tmpprog.sas&quot;;&lt;br /&gt;
set fcon end=last;&lt;br /&gt;
length form $ 8;&lt;br /&gt;
if _n_ = 1 then do;&lt;br /&gt;
put &quot;data _null_;&quot;/&quot;set &amp;amp;indata;&quot;;&lt;br /&gt;
put ’file &quot;&amp;amp;outfile&quot;;’ / &quot;put &quot; @;&lt;br /&gt;
end;&lt;br /&gt;
put name @;&lt;br /&gt;
if type = 2 then&lt;br /&gt;
form = &quot;$&quot;||trim(left(put(length,3.)))||&quot;.&quot;;&lt;br /&gt;
else form = &quot;best12.&quot;;&lt;br /&gt;
put form @;&lt;br /&gt;
if ^last then put &quot;+1 &quot; @;&lt;br /&gt;
else put &quot;;&quot; / &quot;run;&quot; ;&lt;br /&gt;
run;&lt;br /&gt;
%include &quot;tmpprog.sas&quot;;&lt;br /&gt;
x ’rm tmpprog.sas’;&lt;br /&gt;
%mend putdat;&lt;br /&gt;


&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;The Display Manager&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
When SAS is invoked, it displays three windows to help you&lt;br /&gt;
interact with your programs and output:&lt;br /&gt;
• Program Window - for editing and submitting SAS statements&lt;br /&gt;
• Log Window - for viewing and saving log output&lt;br /&gt;
• Output Window - for viewing and saving output&lt;br /&gt;
Some commands which open other useful windows include:&lt;br /&gt;
• assist - menu driven version of SAS&lt;br /&gt;
• dir - shows data sets in a library&lt;br /&gt;
• var - shows variables in a data set&lt;br /&gt;
• notepad - simple text window&lt;br /&gt;
• options - view and change system options&lt;br /&gt;
• filename - view current filename assignments&lt;br /&gt;
• help - interactive help system&lt;br /&gt;
• libname - view current libname assignments&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Appearance of Display Manager&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;OUTPUT&lt;/b&gt;----------------------------------------------------------------------------------+&lt;br /&gt;
|Command ===&amp;gt; |&lt;br /&gt;
| |&lt;br /&gt;
| |&lt;br /&gt;
| |&lt;br /&gt;
| |&lt;br /&gt;
| |&lt;br /&gt;
| |&lt;br /&gt;
| |&lt;br /&gt;
| |&lt;br /&gt;
| |&lt;br /&gt;
| |&lt;br /&gt;
| |&lt;br /&gt;
&lt;b&gt;LOG&lt;/b&gt;-------------------------------------------------------------------------------------+&lt;br /&gt;
|File Edit View Locals Globals Help |&lt;br /&gt;
| |&lt;br /&gt;
| |&lt;br /&gt;
|This is version 6.11 of the SAS System. |&lt;br /&gt;
| |&lt;br /&gt;
| |&lt;br /&gt;
|NOTE: AUTOEXEC processing beginning; file is /app/sas611/autoexec.sas. |&lt;br /&gt;
| |&lt;br /&gt;
|NOTE: SAS initialization used: |&lt;br /&gt;
| real time 0.567 seconds |&lt;br /&gt;
| cpu time 0.421 seconds |&lt;br /&gt;
| |&lt;br /&gt;
&lt;b&gt;PROGRAM EDITOR&lt;/b&gt;--------------------------------------------------------------------------+&lt;br /&gt;
|Command ===&amp;gt; |&lt;br /&gt;
| |&lt;br /&gt;
|00001 |&lt;br /&gt;
|00002 |&lt;br /&gt;
|00003 |&lt;br /&gt;
|00004 |&lt;br /&gt;
|00005 |&lt;br /&gt;
|00006 |&lt;br /&gt;
|00007 |&lt;br /&gt;
|00008 |&lt;br /&gt;
|00009 |&lt;br /&gt;
|00010 |&lt;br /&gt;
+---------------------------------------------------------------------------------------+&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Entering Display Manager Commands&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
You can type display manager commands on the command line of&lt;br /&gt;
any display manager window. (To switch from menu bar to&lt;br /&gt;
command line select Globals -&amp;gt; Options -&amp;gt; Command line; to&lt;br /&gt;
switch back to menu bar, enter the command command.)&lt;br /&gt;
You can also enter display manager commands from the program&lt;br /&gt;
editor by surrounding them in quotes, and preceding them by dm,&lt;br /&gt;
provided that the display manager is active.&lt;br /&gt;
Some useful display manager commands which work in any window&lt;br /&gt;
include:&lt;br /&gt;
• clear - clear the contents of the window&lt;br /&gt;
• end - close the window&lt;br /&gt;
• endsas - end the sas session&lt;br /&gt;
• file &quot;filename&quot; - save contents of the window to filename&lt;br /&gt;
• prevcmd - recall previous display manager command&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;The Program Editor&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
There are a number of special display manager commands available&lt;br /&gt;
in the program editor.&lt;br /&gt;
• submit - submit all the lines in the editor to SAS&lt;br /&gt;
• subtop - submit the first line in the editor to SAS&lt;br /&gt;
• recall - place submitted statements back in the editor&lt;br /&gt;
• include &quot;file&quot; - place the contents of file in the editor&lt;br /&gt;
• hostedit - on UNIX systems, invoke the editor described in&lt;br /&gt;
the editcmd system option&lt;br /&gt;
Typing control-x when the cursor is in the program editor toggles&lt;br /&gt;
between insert and overwrite mode.&lt;br /&gt;
You can close the program window with the display manager&lt;br /&gt;
command program off.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Using the Program Editor&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
There are two types of commands which can be used with the&lt;br /&gt;
program editor&lt;br /&gt;
• Command line commands are entered in the Command ===&amp;gt;&lt;br /&gt;
prompt, or are typed into a window when menus are in effect.&lt;br /&gt;
• Line commands are entered by typing over the numbered lines&lt;br /&gt;
on the left hand side of the editor window. Many of the line&lt;br /&gt;
commands allow you to operate on multiple selected lines of&lt;br /&gt;
text.&lt;br /&gt;
In addition, any of the editor or other display manager commands&lt;br /&gt;
can be assigned to a function or control key, as will be explained&lt;br /&gt;
later.&lt;br /&gt;
Note: The undo command can be used to reverse the effect of&lt;br /&gt;
editing commands issued in the display manager.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Editor Line Commands&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Commands followed by &amp;lt;n&amp;gt; optionally accept a number to act on&lt;br /&gt;
multiple lines.&lt;br /&gt;
Inserting Lines Deleting Lines&lt;br /&gt;
i&amp;lt;n&amp;gt; insert after current line d&amp;lt;n&amp;gt; delete lines&lt;br /&gt;
ib&amp;lt;n&amp;gt; insert before current line dd block delete&lt;br /&gt;
Moving Lines Copying Lines&lt;br /&gt;
m&amp;lt;n&amp;gt; move lines c&amp;lt;n&amp;gt; copy lines&lt;br /&gt;
mm block move cc block copy&lt;br /&gt;
Other Commands&lt;br /&gt;
&amp;gt;&amp;gt;&amp;lt;n&amp;gt; indent lines &amp;lt;&amp;lt;&amp;lt;n&amp;gt; remove indentation&lt;br /&gt;
tc connect text ts split text&lt;br /&gt;
Type block commands on the starting and ending lines of the block&lt;br /&gt;
and use a b or a command to specify the a line before which or&lt;br /&gt;
after which the block should be placed.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Defining Function and Control Keys&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
You can define function keys, control keys, and possibly other keys&lt;br /&gt;
depending on your operating system, through the keys window of&lt;br /&gt;
the display manager.&lt;br /&gt;
To define a function key to execute a display manager command,&lt;br /&gt;
enter the name of the command in the right hand field next to the&lt;br /&gt;
key you wish to define.&lt;br /&gt;
To define a function key to execute an editor line command, enter&lt;br /&gt;
the letter(s) corresponding to the command preceded by a colon (:)&lt;br /&gt;
in the right hand field.&lt;br /&gt;
To define a function key to insert text into the editor, precede the&lt;br /&gt;
text to be inserted with a tilda (~) in the right hand field.&lt;br /&gt;
Some display manager commands only make sense when defined&lt;br /&gt;
through keys. For example the command home puts the cursor on&lt;br /&gt;
the command line of a display manager window.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;More on Function Keys&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
You can define a function key to perform several commands by&lt;br /&gt;
separating the commands with a semicolon (;).&lt;br /&gt;
Function keys defining display manager commands are executed&lt;br /&gt;
before any text which is on the command line. Thus, you can enter&lt;br /&gt;
arguments to display manager commands before hitting the&lt;br /&gt;
appropriate function key.&lt;br /&gt;
To set function keys without using the keys window, use the&lt;br /&gt;
display manager keydef command, for example:&lt;br /&gt;
keydef f2 rfind&lt;br /&gt;
Keys set in this way will only be in effect for the current session.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Cutting and Pasting&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
If block moves and/or copies do not satisfy your editing needs, you&lt;br /&gt;
can cut and paste non-rectangular blocks of text. Using these&lt;br /&gt;
commands generally requires that keys have been defined for the&lt;br /&gt;
display manager commands mark, cut, and paste, or home.&lt;br /&gt;
To define a range of text, issue the mark command at the beginning&lt;br /&gt;
and end of the text you want cut or pasted. Then issue the cut&lt;br /&gt;
(destructive) or store (non-destructive) command. Finally, place&lt;br /&gt;
the cursor at the point to which you want the text moved, and&lt;br /&gt;
issue the paste command.&lt;br /&gt;
When using cut or store, you can optionally use the append&lt;br /&gt;
option, which allows you to build up the contents of the paste&lt;br /&gt;
buffer with several distinct cuts or copies, or the buffer=name&lt;br /&gt;
option, to create or use a named buffer.&lt;br /&gt;


&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Searching and Changing Text&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The display manager provides the following commands for&lt;br /&gt;
searching and, in the program editor or notepad, changing text.&lt;br /&gt;
These commands include:&lt;br /&gt;
• find string - search forward for string&lt;br /&gt;
• bfind string - search backward for string&lt;br /&gt;
• rfind - repeat previous find command&lt;br /&gt;
• change old new - change old to new&lt;br /&gt;
• rchange - repeat previous change command&lt;br /&gt;
Each of these commands takes a variety of options:&lt;br /&gt;
Scope of Search: next, first, last, prev, all&lt;br /&gt;
Component of Search: word, prefix, suffix&lt;br /&gt;
Case Independence: icase&lt;br /&gt;
If there are blanks or special symbols in any of the strings,&lt;br /&gt;
surround the entire string in single or double quotes.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Using the Find and Change Commands&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
• To change every occurence of the string “sam” to “fred”,&lt;br /&gt;
ignoring the case of the first string, enter&lt;br /&gt;
change sam fred all icase&lt;br /&gt;
• To selectively change the word cat to dog, use&lt;br /&gt;
change cat dog word&lt;br /&gt;
followed by repeated use of rfind, to find the next occurence&lt;br /&gt;
of the word, and rchange if a change is desired.&lt;br /&gt;
• To count the number of occurences of the word fish, use&lt;br /&gt;
find fish all&lt;br /&gt;
and the count will be displayed under the command line.&lt;br /&gt;
If an area of text is marked (using the display manager mark&lt;br /&gt;
command), then search and/or find commands apply only to the&lt;br /&gt;
marked region.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;div style=&quot;margin-bottom: 12.0pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 18.0pt;&quot;&gt;Customizing
the Display Manager&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Key definitions entered through the keys window are automatically&lt;br /&gt;
stored from session to session.&lt;br /&gt;
The color display manager command allows you to customize the&lt;br /&gt;
colors of various components of SAS windows. The sascolor&lt;br /&gt;
window allows you to change colors through a window.&lt;br /&gt;
To save the geometry and location of display manager windows,&lt;br /&gt;
issue the display manager command wsave from within a given&lt;br /&gt;
window, or wsave all to save for all windows.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/8823590938778501548/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2013/11/review-introduction-to-sas-system-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/8823590938778501548'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/8823590938778501548'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2013/11/review-introduction-to-sas-system-part-2.html' title='Review: An Introduction to the SAS System Part-2'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-6295434354364487638</id><published>2013-11-22T00:33:00.003+05:30</published><updated>2013-11-22T00:33:42.045+05:30</updated><title type='text'>Review: An Introduction to the SAS System Part-1</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;What is SAS?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;• Developed in the early 1970s at North Carolina State&lt;br /&gt;University&lt;br /&gt;• Originally intended for management and analysis of&lt;br /&gt;agricultural field experiments&lt;br /&gt;• Now the most widely used statistical software&lt;br /&gt;• Used to stand for “Statistical Analysis System”, now it is not&lt;br /&gt;an acronym for anything&lt;br /&gt;• Pronounced “sass”, not spelled out as three letters.&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Overview of SAS Products&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;• Base SAS - data management and basic procedures&lt;br /&gt;• SAS/STAT - statistical analysis&lt;br /&gt;• SAS/GRAPH - presentation quality graphics&lt;br /&gt;• SAS/OR - Operations research&lt;br /&gt;• SAS/ETS - Econometrics and Time Series Analysis&lt;br /&gt;• SAS/IML - interactive matrix language&lt;br /&gt;• SAS/AF - applications facility (menus and interfaces)&lt;br /&gt;• SAS/QC - quality control&lt;br /&gt;There are other specialized products for spreadsheets, access to&lt;br /&gt;databases, connectivity between different machines running SAS,&lt;br /&gt;etc.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Resources: Introductory Books&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;Mastering the SAS System, 2nd Edition, by Jay A. Jaffe,&lt;br /&gt;Van Nostrand Reinhold&lt;br /&gt;Quick Start to Data Analysis with SAS, by Frank C. DiIorio and&lt;br /&gt;Kenneth A. Hardy, Duxbury Press.&lt;br /&gt;How SAS works: a comprehensive introduction to the SAS System, by&lt;br /&gt;P.A. Herzberg, Springer-Verlag&lt;br /&gt;Applied statistics and the SAS programming language, by R.P. Cody,&lt;br /&gt;North-Holland, New York&lt;br /&gt;The bulk of SAS documentation is available online, at&lt;br /&gt;http://support.sas.com/documentation/onlinedoc/index.html. A&lt;br /&gt;catalog of printed documentation available from SAS can be found at&lt;br /&gt;http://support.sas.com/publishing/index.html.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Online Resources&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;Online help: Type help in the SAS display manager input window.&lt;br /&gt;Sample Programs, distributed with SAS on all platforms.&lt;br /&gt;SAS Institute Home Page: http://www.sas.com&lt;br /&gt;SAS Institute Technical Support:&lt;br /&gt;http://support.sas.com/resources/&lt;br /&gt;Searchable index to SAS-L, the SAS mailing list:&lt;br /&gt;http://www.listserv.uga.edu/archives/sas-l.html&lt;br /&gt;Usenet Newsgroup (equivalent to SAS-L):&lt;br /&gt;comp.soft-sys.sas&lt;br /&gt;Michael Friendly’s Guide to SAS Resources on the Internet:&lt;br /&gt;http://www.math.yorku.ca/SCS/StatResource.html#SAS&lt;br /&gt;Brian Yandell’s Introduction to SAS:&lt;br /&gt;http://www.stat.wisc.edu/~yandell/software/sas/intro.html&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Basic Structure of SAS&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;There are two main components to most SAS programs - the data&lt;br /&gt;step(s) and the procedure step(s).&lt;br /&gt;The data step reads data from external sources, manipulates and&lt;br /&gt;combines it with other data set and prints reports. The data step is&lt;br /&gt;used to prepare your data for use by one of the procedures (often&lt;br /&gt;called “procs”).&lt;br /&gt;SAS is very lenient about the format of its input - statements can&lt;br /&gt;be broken up across lines, multiple statements can appear on a&lt;br /&gt;single line, and blank spaces and lines can be added to make the&lt;br /&gt;program more readable.&lt;br /&gt;The procedure steps perform analysis on the data, and produce&lt;br /&gt;(often huge amounts of) output.&lt;br /&gt;The most effective strategy for learning SAS is to concentrate on&lt;br /&gt;the details of the data step, and learn the details of each procedure&lt;br /&gt;as you have a need for them.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Accessing SAS&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;There are four ways to access SAS on a UNIX system:&lt;br /&gt;1. Type sas . This opens the SAS “display manager”, which&lt;br /&gt;consists of three windows (program, log, and output). Some&lt;br /&gt;procedures must be run from the display manager.&lt;br /&gt;2. Type sas -nodms . You will be prompted for each SAS&lt;br /&gt;statement, and output will scroll by on the screen.&lt;br /&gt;3. Type sas -stdio . SAS will act like a standard UNIX&lt;br /&gt;program, expecting input from standard input, sending the log&lt;br /&gt;to standard error, and the output to standard output;&lt;br /&gt;4. Type sas filename.sas . This is the batch mode of SAS -&lt;br /&gt;your program is read from filename.sas, the log goes to&lt;br /&gt;filename.log and the output goes to filename.lst.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Some Preliminary Concepts and Rules&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;• SAS variable names must be 32 characters or less, constructed&lt;br /&gt;of letters, digits and the underscore character. (Before version&lt;br /&gt;7, the limit was 8.)&lt;br /&gt;• It’s a good idea not to start variable names with an underscore,&lt;br /&gt;because special system variables are named that way.&lt;br /&gt;• Data set names follow similar rules as variables, but they have&lt;br /&gt;a different name space.&lt;br /&gt;• There are virtually no reserved keywords in SAS; it’s very good&lt;br /&gt;at figuring things out by context.&lt;br /&gt;• SAS is not case sensitive, except inside of quoted strings.&lt;br /&gt;Starting in Version 7, SAS will remember the case of variable&lt;br /&gt;names when it displays them.&lt;br /&gt;• Missing values are handled consistently in SAS, and are&lt;br /&gt;represented by a period (.).&lt;br /&gt;• Each statement in SAS must end in a semicolon (;).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Structure of SAS programs&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;• Lines beginning with an asterisk (*) are treated as comments.&lt;br /&gt;Alternatively you can enclose comments between /* and */.&lt;br /&gt;• You can combine as many data and proc steps in whatever&lt;br /&gt;order you want.&lt;br /&gt;• Data steps begin with the word data and procedure steps&lt;br /&gt;begin with the word proc.&lt;br /&gt;• The run; command signals to SAS that the previous&lt;br /&gt;commands can be executed.&lt;br /&gt;• Terminate an interactive SAS job with the endsas; statement.&lt;br /&gt;• There are global options (like linesize and pagesize) as well as&lt;br /&gt;options specific to datasets and procedures.&lt;br /&gt;• Informative messages are written to the SAS log - make sure&lt;br /&gt;you read it!&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;The Data Step&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The data step provides a wide range of capabilities, among them&lt;br /&gt;reading data from external sources, reshaping and manipulating&lt;br /&gt;data, transforming data and producing printed reports.&lt;br /&gt;The data step is actually an implied do loop whose statements will&lt;br /&gt;be executed for each observation either read from an external&lt;br /&gt;source, or accessed from a previously processed data set.&lt;br /&gt;For each iteration, the data step starts with a vector of missing&lt;br /&gt;values for all the variables to be placed in the new observation. It&lt;br /&gt;then overwrites the missing value for any variables either input or&lt;br /&gt;defined by the data step statements. Finally, it outputs the&lt;br /&gt;observation to the newly created data set.&lt;br /&gt;The true power of the data step is illustrated by the fact that all of&lt;br /&gt;these defaults may be overridden if necessary.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Data Step: Basics&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Each data step begins with the word data and optionally one or&lt;br /&gt;more data set names (and associated options) followed by a&lt;br /&gt;semicolon. The name(s) given on the data step are the names of&lt;br /&gt;data sets which will be created within the data step.&lt;br /&gt;If you don’t include any names on the data step, SAS will create&lt;br /&gt;default data set names of the form datan, where n is an integer&lt;br /&gt;which starts at 1 and is incremented so that each data set created&lt;br /&gt;has a unique name within the current session. Since it becomes&lt;br /&gt;difficult to keep track of the default names, it is recommended that&lt;br /&gt;you always explicitly specify a data set name on the data&lt;br /&gt;statement.&lt;br /&gt;When you are running a data step to simply generate a report, and&lt;br /&gt;don’t need to create a data set, you can use the special data set&lt;br /&gt;name _null_ to eliminate the output of observations.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Data Step: Inputting Data&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The input statement of SAS is used to read data from an external&lt;br /&gt;source, or from lines contained in your SAS program.&lt;br /&gt;The infile statement names an external file or fileref  from which&lt;br /&gt;to read the data; otherwise the cards; or datalines; statement is&lt;br /&gt;used to precede the data.&lt;br /&gt;data one;&lt;br /&gt;infile &quot;input.data&quot;;&lt;br /&gt;input a b c;&lt;br /&gt;run;&lt;br /&gt;Reading data from an external file&lt;br /&gt;data one;&lt;br /&gt;input a b c;&lt;br /&gt;datalines;&lt;br /&gt;. . .&lt;br /&gt;;&lt;br /&gt;Reading from inline data&lt;br /&gt;By default, each invocation of the input statement reads another&lt;br /&gt;record. This example uses free-form input, with at least one space&lt;br /&gt;between values.&lt;br /&gt; A fileref is a SAS name, created by the filename statement, which refers to&lt;br /&gt;an external file or other device&lt;br /&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Data Step: input Statement&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;There are three basic forms of the input statement:&lt;br /&gt;1. List input (free form) - data fields must be separated by at&lt;br /&gt;least one blank. List the names of the variables, follow the&lt;br /&gt;name with a dollar sign ($) for character data.&lt;br /&gt;2. Column input - follow the variable name (and $ for character)&lt;br /&gt;with startingcolumn – endingcolumn.&lt;br /&gt;3. Formatted input - Optionally precede the variable name with&lt;br /&gt;@startingcolumn; follow the variable name with a SAS format&lt;br /&gt;designation. (Examples of formats: $10. (10 column&lt;br /&gt;character), 6. (6 column numeric))&lt;br /&gt;When mixing different input styles, note that for column and&lt;br /&gt;formatted input, the next input directive reads from the column&lt;br /&gt;immediately after the previous value, while for list input, the next&lt;br /&gt;directive reads from the second column after the previous value.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Modifiers for List Input&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The colon (:) modifier for list input tells SAS to use a format for&lt;br /&gt;input, but to stop when the next whitespace is found. Data like:&lt;br /&gt;17,244 2,500,300 600 12,003&lt;br /&gt;14,120 2,300 4,232 25&lt;br /&gt;could be read using an input statement like&lt;br /&gt;input x1 : comma. x2 : comma. x3 : comma. x4 : comma. ;&lt;br /&gt;The ampersand (&amp;amp;) modifier tells SAS to use two whitespace&lt;br /&gt;characters to signal the end of a character variable, allowing&lt;br /&gt;embedded blanks to be read using list input. Thus, the statements:&lt;br /&gt;length name $ 25;&lt;br /&gt;input name &amp;amp; $ year;&lt;br /&gt;could be used to read data such as&lt;br /&gt;George Washington 1789&lt;br /&gt;John Adams 1797&lt;br /&gt;Thomas Jefferson 1801&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Other Modifiers for the Input Statement&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;+number advance number columns.&lt;br /&gt;#number advance to line number.&lt;br /&gt;/ advance to next line.&lt;br /&gt;trailing @ hold the line to allow further input statements in this&lt;br /&gt;iteration of the data step on the same data.&lt;br /&gt;trailing @@ hold the line to allow continued reading from the line&lt;br /&gt;on subsequent iterations of the data step.&lt;br /&gt;Note: If SAS needs to read an additional line to input all the&lt;br /&gt;variables referenced in the input statement it prints the following&lt;br /&gt;message on the log:&lt;br /&gt;NOTE: SAS went to a new line when INPUT statement reached past&lt;br /&gt;the end of a line.&lt;br /&gt;If you see this note, make sure you understand why it was printed!!&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;The input Statement&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Variable lists can be used on the input statement. For example, the&lt;br /&gt;list var1 - var4 expands to var1 var2 var3 var4.&lt;br /&gt;You can repeat formats for variable lists by including the names&lt;br /&gt;and formats in parentheses: (var1 - var4) (5.) reads four&lt;br /&gt;numeric variables from 20 consecutive columns (5 columns for each&lt;br /&gt;variable).&lt;br /&gt;You can also repeat formats using the notation num*format. The&lt;br /&gt;previous example could be replaced with (4 * 5.).&lt;br /&gt;A null input statement (no variables) can be used to free holding&lt;br /&gt;caused by trailing @-signs.&lt;br /&gt;The @, + and # specifications can all be followed by a variable name&lt;br /&gt;instead of a number.&lt;br /&gt;If you want to make sure your input data is really arranged the way&lt;br /&gt;you think it is, the list; command will display your input data&lt;br /&gt;with a “ruler” showing column numbers.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;FTP Access&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;SAS provides the ability to read data directly from an FTP server,&lt;br /&gt;without the need to create a local copy of the file, through the ftp&lt;br /&gt;keyword of the filename statement.&lt;br /&gt;Suppose there is a data file called user.dat in the directory&lt;br /&gt;public on an ftp server named ftp.myserver.com. If your user&lt;br /&gt;name is joe and your password is secret, the following statement&lt;br /&gt;will establish a fileref for reading the data:&lt;br /&gt;filename myftp ftp ’user.dat’ cd=’/public’ user=’joe’&lt;br /&gt;pass=’secret’ host=’ftp.myserver.com’;&lt;br /&gt;The fileref can now be used in the infile statement in the usual&lt;br /&gt;way.&lt;br /&gt;You can read files from http (web) servers in a similar fashion,&lt;br /&gt;using the url keyword.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Options for the infile statement&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;For inline data, use the infile name cards or datalines.&lt;br /&gt;missover Sets values to missing if an input statement would&lt;br /&gt;read more than one line.&lt;br /&gt;stopover Like missover, but declares an error and stops&lt;br /&gt;lrecl=num Treats the input as having a length of num characters.&lt;br /&gt;Required if input records are longer than 256 characters.&lt;br /&gt;dlm=’chars’ Uses the characters in chars instead of blanks&lt;br /&gt;and tabs as separators in list (free-form) input.&lt;br /&gt;dsd Read comma-separated data&lt;br /&gt;expandtabs expand tabs to spaces before inputting data.&lt;br /&gt;end=varname creates a SAS variable whose value is 1 when SAS&lt;br /&gt;processes the last line in the file.&lt;br /&gt;obs=n Limits processing of infile to n records&lt;br /&gt;pad Adds blanks to lines that are shorter than the input&lt;br /&gt;statement specifies.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Variable Length Records&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Consider the following file, containing the year and name of the&lt;br /&gt;first three American presidents:&lt;br /&gt;1789 George Washington&lt;br /&gt;1797 John Adams&lt;br /&gt;1801 Thomas Jefferson&lt;br /&gt;If we were to use an input statement like&lt;br /&gt;input year 4. @6 name $17.;&lt;br /&gt;SAS would try to read past the end of the second line, since the&lt;br /&gt;name only has 10 characters. The solution is the pad option of the&lt;br /&gt;infile statement. Suppose the data is in a file called p.txt. The&lt;br /&gt;following program correctly reads the data:&lt;br /&gt;data pres;&lt;br /&gt;infile ’p.txt’ pad;&lt;br /&gt;input year 4. @6 name $17.;&lt;br /&gt;run;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Reading SAS programs from external files&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The infile statement can be used to read data which is stored in&lt;br /&gt;a file separate from your SAS program. When you want SAS to&lt;br /&gt;read your program from an external file you can use the %include&lt;br /&gt;statement, followed by a filename or fileref. After SAS processes a&lt;br /&gt;%include statement, it continues to read data from its original&lt;br /&gt;source (input file, keyboard or display manager.)&lt;br /&gt;For example, suppose the SAS program statements to read a file&lt;br /&gt;and create a data set are in the system file readit.sas. To process&lt;br /&gt;those statements, and then print the data set, the following&lt;br /&gt;commands can be used:&lt;br /&gt;%include &quot;readit.sas&quot;;&lt;br /&gt;proc print;&lt;br /&gt;run;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;proc import&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;For certain simple data files, SAS can create a SAS data set directly&lt;br /&gt;using proc import. The dbms= option informs SAS of the type of&lt;br /&gt;file to be read, and choices include xls (Excel spreadsheets), csv&lt;br /&gt;(Comma-separated values), dbf (Dbase files), dta (Stata files), sav&lt;br /&gt;(SPSS files), and tab (Tab-separated files). For example,to read an&lt;br /&gt;Excel spreadsheet called data.xls into a SAS data set named&lt;br /&gt;xlsdata, the following statements can be used:&lt;br /&gt;proc import dbms=xls datafile=’data.xls’ out=xlsdata;&lt;br /&gt;run;&lt;br /&gt;proc import provides no options for formatting, and may not be&lt;br /&gt;successful with all types of data files&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Repetitive Processing of Variables&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The array statement can be used to perform the same task on a&lt;br /&gt;group of variables.&lt;br /&gt;array arrayname variable list &amp;lt;$&amp;gt; &amp;lt;(startingvalues)&amp;gt;;&lt;br /&gt;array arrayname{n} variable list &amp;lt;$&amp;gt; &amp;lt;(startingvalues)&amp;gt;;&lt;br /&gt;You can then use the array name with curly braces ({}) and a&lt;br /&gt;subscript, or in a do over loop:&lt;br /&gt;array x x1-x9;&lt;br /&gt;do i = 1 to dim(x);&lt;br /&gt;if x{i} = 9 then x{i} = .;&lt;br /&gt;end;&lt;br /&gt;array x x1-x9;&lt;br /&gt;do over x;&lt;br /&gt;if x = 9 then x = .;&lt;br /&gt;end;&lt;br /&gt;Notes: 1. All the variables in an array must be of the same type.&lt;br /&gt;2. An array can not have the same name as a variable.&lt;br /&gt;3. You can use the keyword _temporary_ instead of a variable list.&lt;br /&gt;4. The statement array x{3}; generates variables x1, x2, and x3.&lt;br /&gt;5. The function dim returns the number of elements in an array.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Titles and Footnotes&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;SAS allows up to ten lines of text at the top (titles) and bottom&lt;br /&gt;(footnotes) of each page of output, specified with title and&lt;br /&gt;footnote statements. The form of these statements is&lt;br /&gt;title&amp;lt;n&amp;gt; text; or footnote&amp;lt;n&amp;gt; text;&lt;br /&gt;where n, if specified, can range from 1 to 10, and text must be&lt;br /&gt;surrounded by double or single quotes. If text is omitted, the title&lt;br /&gt;or footnote is deleted; otherwise it remains in effect until it is&lt;br /&gt;redefined. Thus, to have no titles, use:&lt;br /&gt;title;&lt;br /&gt;By default SAS includes the date and page number on the top of&lt;br /&gt;each piece of output. These can be suppressed with the nodate and&lt;br /&gt;nonumber system options.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Missing Values&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;SAS handles missing values consistently throughout various&lt;br /&gt;procedures, generally by deleting observations which contain&lt;br /&gt;missing values. It is therefore very important to inspect the log and&lt;br /&gt;listing output, as well as paying attention to the numbers of&lt;br /&gt;observations used, when your data contains missing values.&lt;br /&gt;For character variables, a missing value is represented by a blank&lt;br /&gt;(&quot; &quot; ; not a null string)&lt;br /&gt;For numeric variables, a missing value is represented by a period&lt;br /&gt;(with no quotes). Unlike many languages, you can test for equality&lt;br /&gt;to missing in the usually fasion:&lt;br /&gt;if string = &quot; &quot; then delete; * character variable;&lt;br /&gt;if num = . then delete; * numeric variable;&lt;br /&gt;if x &amp;gt; 10 then x = .; * set a variable to missing;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Special Missing Values&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;In addition to the regular missing value (.), you can specify one or&lt;br /&gt;more single alphabetic characters which will be treated as missing&lt;br /&gt;values when encountered in your input.&lt;br /&gt;Most procedures will simply treat these special missing values in&lt;br /&gt;the usual way, but others (such as freq and summary) have options&lt;br /&gt;to tabulate each type of missing value separately. For example,&lt;br /&gt;data one;&lt;br /&gt;missing x;&lt;br /&gt;input vv @@;&lt;br /&gt;datalines;&lt;br /&gt;12 4 5 6 x 9 . 12&lt;br /&gt;;&lt;br /&gt;The 5th and 7th observations will&lt;br /&gt;both be missing, but internally they&lt;br /&gt;are stored in different ways.&lt;br /&gt;Note: When you use a special missing value, it will not be detected&lt;br /&gt;by a statement like if vv = .; in the example above, you would&lt;br /&gt;need to use if vv = .x to detect the special missing value, or to&lt;br /&gt;use the missing function of the data step.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Variable Lists&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;SAS provides several different types of variable lists, which can be&lt;br /&gt;used in all procedures, and in some data step statements.&lt;br /&gt;• Numbered List - When a set of variables have the same prefix,&lt;br /&gt;and the rest of the name is a consecutive set of numbers, you&lt;br /&gt;can use a single dash (-) to refer to an entire range:&lt;br /&gt;x1 - x3 ) x1, x2, x3; x01 - x03 ) x01, x02, x03&lt;br /&gt;• Colon list - When a set of variables all begin with the same&lt;br /&gt;sequence of characters you can place a colon after the sequence&lt;br /&gt;to include them all. If variables a, b, xheight, and xwidth&lt;br /&gt;have been defined, then x:)xwidth, xheight.&lt;br /&gt;• Special Lists - Three keywords refer to a list with the obvious&lt;br /&gt;meaning: numeric character all&lt;br /&gt;In a data step, special lists will only refer to variables which&lt;br /&gt;were already defined when the list is encountered.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Variable Lists (cont’d)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;• Name range list - When you refer to a list of variables in the&lt;br /&gt;order in which they were defined in the SAS data set, you can&lt;br /&gt;use a double dash (--) to refer to the range:&lt;br /&gt;If the input statement&lt;br /&gt;input id name $ x y z state $ salary&lt;br /&gt;was used to create a data set, then&lt;br /&gt;x -- salary ) x, y, z, state, salary&lt;br /&gt;If you only want character or numeric variables in the name&lt;br /&gt;range, insert the appropriate keyword between the dashes:&lt;br /&gt;id -numeric- z ) id, x, y, z&lt;br /&gt;In general, variables are defined in the order they appear in the&lt;br /&gt;data step. If you’re not sure about the order, you can check&lt;br /&gt;using proc contents.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;The set statement&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;When you wish to process an already created SAS data set instead&lt;br /&gt;of raw data, the set statement is used in place of the input and&lt;br /&gt;infile or lines statements.&lt;br /&gt;Each time it encounters a set statement, SAS inputs an&lt;br /&gt;observation from an existing data set, containing all the variables&lt;br /&gt;in the original data set along with any newly created variables.&lt;br /&gt;This example creates a data set called trans with all the variables&lt;br /&gt;in the data set orig plus a new variable called logx:&lt;br /&gt;data trans;&lt;br /&gt;set orig;&lt;br /&gt;logx = log(x);&lt;br /&gt;run;&lt;br /&gt;You can specify the path to a SAS data set in quotes instead of a&lt;br /&gt;data set name. If you use a set statement without specifying a&lt;br /&gt;data set name, SAS will use the most recently created data set.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;drop= and keep= data set options&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Sometimes you don’t need to use all of the variables in a data set&lt;br /&gt;for further processing. To restrict the variables in an input data&lt;br /&gt;set, the data set option keep= can be used with a list of variable&lt;br /&gt;names. For example, to process the data set big, but only using&lt;br /&gt;variables x, y, and z, the following statements could be used:&lt;br /&gt;data new;&lt;br /&gt;set big(keep = x y z);&lt;br /&gt;. . .&lt;br /&gt;Using a data set option in this way is very efficient, because it&lt;br /&gt;prevents all the variables from being read for each observation. If&lt;br /&gt;you only wanted to remove a few variables from the data set, you&lt;br /&gt;could use the drop= option to specify the variables in a similar&lt;br /&gt;fashion.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;drop and keep statements&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;To control the variables which will be output to a data set, drop or&lt;br /&gt;keep statements can be used. (It is an error to specify both drop&lt;br /&gt;and keep in the same data step). Suppose we have a data set with&lt;br /&gt;variables representing savings and income. We wish to output&lt;br /&gt;only those observations for which the ratio of savings to income is&lt;br /&gt;greater than 0.05, but we don’t need this ratio output to our final&lt;br /&gt;result.&lt;br /&gt;data savers;&lt;br /&gt;set all;&lt;br /&gt;test = savings / income;&lt;br /&gt;if test &amp;gt; .05 then output;&lt;br /&gt;drop test;&lt;br /&gt;run;&lt;br /&gt;As an alternative to drop, the statement&lt;br /&gt;keep income savings;&lt;br /&gt;could have been used instead.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;retain statement&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;SAS’ default behavior is to set all variables to missing each time a&lt;br /&gt;new observation is read. Sometimes it is necessary to “remember”&lt;br /&gt;the value of a variable from the previous observation. The retain&lt;br /&gt;statement specifies variables which will retain their values from&lt;br /&gt;previous observations instead of being set to missing. You can&lt;br /&gt;specify an initial value for retained variables by putting that value&lt;br /&gt;after the variable name on the retain statement.&lt;br /&gt;Note: Make sure you understand the difference between retain&lt;br /&gt;and keep.&lt;br /&gt;For example, suppose we have a data set which we assume is sorted&lt;br /&gt;by a variable called x. To print a message when an out-of-order&lt;br /&gt;observation is encountered, we could use the following code:&lt;br /&gt;retain lastx .; * retain lastx and initialize to missing;&lt;br /&gt;if x &amp;lt; lastx then put ’Observation out of order, x=’ x;&lt;br /&gt;else lastx = x;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;sum Statement&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Many times the sum of a variable needs to be accumulated between&lt;br /&gt;observations in a data set. While a retain statement could be used,&lt;br /&gt;SAS provides a special way to accumulate values known as the sum&lt;br /&gt;statement. The format is&lt;br /&gt;variable + expression;&lt;br /&gt;where variable is the variable which will hold the accumulated&lt;br /&gt;value, and expression is a SAS expression which evaluates to a&lt;br /&gt;numeric value. The value of variable is automatically initialized&lt;br /&gt;to zero. The sum statement is equivalent to the following:&lt;br /&gt;retain variable 0;&lt;br /&gt;variable = variable + expression;&lt;br /&gt;with one important difference. If the value of expression is&lt;br /&gt;missing, the sum statement treats it as a zero, whereas the normal&lt;br /&gt;computation will propogate the missing value.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Default Data Sets&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;In most situations, if you don’t specify a data set name, SAS will&lt;br /&gt;use a default dataset, using the following rules:&lt;br /&gt;• When creating data sets, SAS uses the names data1, data2,&lt;br /&gt;etc, if no data set name is specified. This can happen because&lt;br /&gt;of a data step, or if a procedure automatically outputs a data&lt;br /&gt;set which you have not named.&lt;br /&gt;• When processing data sets, SAS uses the most recently created&lt;br /&gt;data set, which has the special name last . This can happen&lt;br /&gt;when you use a set statement with no dataset name, or invoke&lt;br /&gt;a procedure without a data= argument. To override this, you&lt;br /&gt;can set the value of last to a data set of your choice with the&lt;br /&gt;options statement:&lt;br /&gt;options _last_ = mydata;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Temporary Data Sets&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;By default, the data sets you create with SAS are deleted at the&lt;br /&gt;end of your SAS session. During your session, they are stored in a&lt;br /&gt;directory with a name like SAS workaXXXX, where the Xs are used&lt;br /&gt;to create a unique name. By default, this directory is created&lt;br /&gt;within the system /tmp directory.&lt;br /&gt;You can have the temporary data sets stored in some other&lt;br /&gt;directory using the -work option when you invoke sas, for example:&lt;br /&gt;sas -work .&lt;br /&gt;to use the current directory or, for example,&lt;br /&gt;sas -work /some/other/directory&lt;br /&gt;to specify some other directory.&lt;br /&gt;Note: If SAS terminates unexpectedly, it may leave behind a work&lt;br /&gt;directory which may be very large. If so, it will need to be removed&lt;br /&gt;using operating system commands.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Permanent Data Sets&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;You can save your SAS data sets permanently by first specifying a&lt;br /&gt;directory to use with the libname statement, and then using a two&lt;br /&gt;level data set name in the data step.&lt;br /&gt;libname project &quot;/some/directory&quot;;&lt;br /&gt;data project.one;&lt;br /&gt;Data sets created this way will have filenames of the form&lt;br /&gt;datasetname.sas7bdat.&lt;br /&gt;In a later session, you could refer to the data set directly, without&lt;br /&gt;having to create it in a data step.&lt;br /&gt;libname project &quot;/some/directory&quot;;&lt;br /&gt;proc reg data=project.one;&lt;br /&gt;To search more than one directory, include the directory names in&lt;br /&gt;parentheses.&lt;br /&gt;libname both (&quot;/some/directory&quot; &quot;/some/other/directory&quot;);&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Operators in SAS&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Arithmetic operators:&lt;br /&gt;* multiplication + addition / division&lt;br /&gt;- subtraction ** exponentiation&lt;br /&gt;Comparison Operators:&lt;br /&gt;= or eq equal to ^= or ne not equal to&lt;br /&gt;&amp;gt; or gt greater than &amp;gt;= or ge greater than or equal to&lt;br /&gt;&amp;lt; or lt less than &amp;lt;= or le less than or equal to&lt;br /&gt;Boolean Operators:&lt;br /&gt;&amp;amp; or and and | or or or ^ or not negation&lt;br /&gt;Other Operators:&lt;br /&gt;&amp;gt;&amp;lt; minimum &amp;lt;&amp;gt; maximum || char. concatenation&lt;br /&gt;The in operator lets you test for equality to any of several constant&lt;br /&gt;values. x in (1,2,3) is the same as x=1 | x=2 | x=3.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Comparison Operators&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Use caution when testing two floating point numbers for equality,&lt;br /&gt;due to the limitations of precision of their internal representations.&lt;br /&gt;The round function can be used to alleviate this problem.&lt;br /&gt;Two SAS comparison operators can be combined in a single&lt;br /&gt;statement to test if a variable is within a given range, without&lt;br /&gt;having to use any boolean operators. For example, to see if the&lt;br /&gt;variable x is in the range of 1 to 5, you can use if 1 &amp;lt; x &amp;lt; 5 ....&lt;br /&gt;SAS treats a numeric missing value as being less than any valid&lt;br /&gt;number. Comparisons involving missing values do not return&lt;br /&gt;missing values.&lt;br /&gt;When comparing characters, if a colon is used after the comparison&lt;br /&gt;operator, the longer argument will be truncated for the purpose of&lt;br /&gt;the comparison. Thus, the expression name =: &quot;R&quot; will be true&lt;br /&gt;for any value of name which begins with R.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Logical Variables&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;When you write expressions using comparison operators, they are&lt;br /&gt;processed by SAS and evaluated to 1 if the comparison is true, and&lt;br /&gt;0 if the comparison is false. This allows them to be used in logical&lt;br /&gt;statements like an if statement as well as directly in numerical&lt;br /&gt;calculations.&lt;br /&gt;For example, suppose we want to count the number of observations&lt;br /&gt;in a data set where the variable age is less than 25. Using an if&lt;br /&gt;statement, we could write:&lt;br /&gt;if age &amp;lt; 25 then count + 1;&lt;br /&gt;(Note the use of the sum statement.)&lt;br /&gt;With logical expressions, the same effect can be acheived as follows:&lt;br /&gt;count + (age &amp;lt; 25);&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Logical Variables (cont’d)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;As a more complex example, suppose we want to create a&lt;br /&gt;categorical variable called agegrp from the continuous variable age&lt;br /&gt;where agegrp is 1 if age is less than 20, 2 if age is from 21 to 30, 3&lt;br /&gt;if age is from 31 to 40, and 4 if age is greater than 40. To perform&lt;br /&gt;this transformation with if statements, we could use statements&lt;br /&gt;like the following:&lt;br /&gt;agegrp = 1;&lt;br /&gt;if 20 &amp;lt; age &amp;lt;= 30 then agegrp = 2;&lt;br /&gt;if 30 &amp;lt; age &amp;lt;= 40 then agegrp = 3;&lt;br /&gt;if age &amp;gt; 40 then agegrp = 4;&lt;br /&gt;Using logical variables provides the following shortcut:&lt;br /&gt;agegrp = 1 + (age &amp;gt; 20) + (age &amp;gt; 30) + (age &amp;gt; 40);&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Variable Attributes&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;There are four attributes common to SAS variables.&lt;br /&gt;• length - the number of bytes used to store the variable in a&lt;br /&gt;SAS data set&lt;br /&gt;• informat - the format used to read the variable from raw data&lt;br /&gt;• format - the format used to print the values of the variable&lt;br /&gt;• label - a descriptive character label of up to 40 characters&lt;br /&gt;You can set any one of these attributes by using the statement of&lt;br /&gt;the appropriate name, or you can set all four of them using the&lt;br /&gt;attrib statement.&lt;br /&gt;Since named variable lists depend on the order in which variables&lt;br /&gt;are encountered in the data step, a common trick is to use a&lt;br /&gt;length or attribute statement, listing variables in the order you&lt;br /&gt;want them stored, as the first statement of your data step.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Variable Lengths: Character Values&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;• For character variables, SAS defaults to a length of 8&lt;br /&gt;characters. If your character variables are longer than that,&lt;br /&gt;you’ll need to use a length statement, an informat statement or&lt;br /&gt;supply a format on the input statement.&lt;br /&gt;• When specifying a length or format for a character variable,&lt;br /&gt;make sure to precede the value with a dollar sign ($):&lt;br /&gt;attrib string length = $ 12 format = $char12.;&lt;br /&gt;• The maximum length of a SAS character variable is 32767.&lt;br /&gt;• By default SAS removes leading blanks in character values. To&lt;br /&gt;retain them use the $charw. informat.&lt;br /&gt;• By default SAS pads character values with blanks at the end.&lt;br /&gt;To remove them, use the trim function.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Variable Lengths: Numeric Values&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;• For numeric variables, SAS defaults to a length of 8 bytes&lt;br /&gt;(double precision.) For non-integers, you should probably not&lt;br /&gt;change from the default.&lt;br /&gt;• For integers, the following chart shows the maximum value&lt;br /&gt;which can be stored in the available lengths:&lt;br /&gt;length Max. value length Max. value&lt;br /&gt;3 8,192 6 137,438,953,472&lt;br /&gt;4 2,097,152 7 35,184,372,088,832&lt;br /&gt;5 536,870,912 8 9,007,199,254,740,992&lt;br /&gt;• You can use the default= option of the length statement to set&lt;br /&gt;a default for all numeric variables produced:&lt;br /&gt;length default = 4;&lt;br /&gt;• Even if a numeric variable is stored in a length less than 8, it&lt;br /&gt;will be promoted to double precision for all calculations.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Initialization and Termination&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Although the default behavior of the data step is to automatically&lt;br /&gt;process each observation in an input file or existing SAS data set, it&lt;br /&gt;is often useful to perform specific tasks at the very beginning or&lt;br /&gt;end of a data step. The automatic SAS variable _n_ counts the&lt;br /&gt;number of iterations of the data set. It is always available within&lt;br /&gt;the data step, but never output to a data set. This variable will be&lt;br /&gt;equal to 1 only on the first iteration of the data step, so it can be&lt;br /&gt;used to signal the need for initializations.&lt;br /&gt;To tell when the last observation is being processed in a data step,&lt;br /&gt;the end= variable of either the infile or set statement can be&lt;br /&gt;used. This variable is not output to a data set, but will be equal to&lt;br /&gt;1 only when the last observation of the input file or data set is&lt;br /&gt;being processed, and will equal 0 otherwise; thus any actions to be&lt;br /&gt;done at the very end of processing can be performed when this&lt;br /&gt;variable is equal to 1.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Flow Control: if-then-else&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The if-then statement (with optional else) is used to&lt;br /&gt;conditionally execute SAS statements:&lt;br /&gt;if x &amp;lt; 5 then group = &quot;A&quot;;&lt;br /&gt;t may be followed by a (separate) else statement:&lt;br /&gt;if x &amp;lt; 5 then group = &quot;A&quot;;&lt;br /&gt;else group = &quot;B&quot;;&lt;br /&gt;To execute more than one statement (for either the then or the&lt;br /&gt;else), use a do-end block:&lt;br /&gt;if x &amp;lt; 5 then do;&lt;br /&gt;group = &quot;A&quot;;&lt;br /&gt;use = 0;&lt;br /&gt;end;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Flow Control: Subsetting if&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Using an if statement without a corresponding then serves as a&lt;br /&gt;filter; observations which do not meet the condition will not be&lt;br /&gt;processed any further.&lt;br /&gt;For example, the statement&lt;br /&gt;if age &amp;lt; 60;&lt;br /&gt;is equivalent to the statement&lt;br /&gt;if age &amp;gt;= 60 then delete;&lt;br /&gt;and will prevent observations where age is not less than 60 from&lt;br /&gt;being output to the data set. This type of if statement is therefore&lt;br /&gt;known as a subsetting if.&lt;br /&gt;Note: You can not use an else statement with a subsetting if.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;ifc and ifn functions&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;If your goal is to set a variable to a value based on some logical&lt;br /&gt;expression, the ifc or ifn function may be more convenient than&lt;br /&gt;using an if/else statement. For example, to set a tax rate based&lt;br /&gt;on whether or not a state name is equal to california, the following&lt;br /&gt;could be used:&lt;br /&gt;rate = ifn(state = ’california’,7.25,5.25);&lt;br /&gt;ifn returns numeric values, while ifc returns character values.&lt;br /&gt;result = ifc(score &amp;gt; 80,’pass’,’fail’)&lt;br /&gt;An optional fourth argument can be used to handle the case where&lt;br /&gt;the first argument is missing.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Flow Control: goto statement&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;You can use the goto statement to have SAS process statements in&lt;br /&gt;some other part of your program, by providing a label followed by a&lt;br /&gt;colon before the statements you wish to jump to. Label names&lt;br /&gt;follow the same rules as variable names, but have a different name&lt;br /&gt;space. When a labeled statement is encountered in normal&lt;br /&gt;processing, it is ignored.&lt;br /&gt;Use goto statements with caution, since they can make program&lt;br /&gt;logic difficult to follow.&lt;br /&gt;data two;&lt;br /&gt;set one;&lt;br /&gt;if x ^= . then goto out;&lt;br /&gt;x = (y + z) / 2;&lt;br /&gt;out: if x &amp;gt; 20 then output;&lt;br /&gt;run;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Flow Control: stop, abort, return&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Although rarely necessary, it is sometimes useful to override SAS’&lt;br /&gt;default behavior of processing an entire set of data statements for&lt;br /&gt;each observation. Control within the current execution of the data&lt;br /&gt;step can be acheived with the goto statement; these statements&lt;br /&gt;provide more general control.&lt;br /&gt;stop immediately discontinue entire execution of the data step&lt;br /&gt;abort like stop, but set error to 1&lt;br /&gt;error like abort, but prints a message to the SAS log&lt;br /&gt;return begin execution of next iteration of data step&lt;br /&gt;For example, the following statement would stop processing the&lt;br /&gt;current data step and print an error message to the log:&lt;br /&gt;if age &amp;gt; 99 then error &quot;Age is too large for subject number &quot; subjno ;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Do-loops&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Do-loops are one of the main tools of SAS programming. They&lt;br /&gt;exist in several forms, always terminated by an end; statement&lt;br /&gt;• do; - groups blocks of statements together&lt;br /&gt;• do over arrayname; - process array elements&lt;br /&gt;• do var=start to end &amp;lt;by inc&amp;gt;; - range of numeric values&lt;br /&gt;• do var=list-of-values;&lt;br /&gt;• do while(expression); (expression evaluated before loop)&lt;br /&gt;• do until(expression); (expression evaluated after loop)&lt;br /&gt;The do until loop is guaranteed to be executed at least once.&lt;br /&gt;Some of these forms can be combined, for example&lt;br /&gt;do i= 1 to end while (sum &amp;lt; 100);&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Iterative Do-loops: Example 1&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Do-loops can be nested. The following example calculates how long&lt;br /&gt;it would take for an investment with interest compounded monthly&lt;br /&gt;to double:&lt;br /&gt;data interest;&lt;br /&gt;do rate = 4,4.5,5,7,9,20;&lt;br /&gt;mrate = rate / 1200; * convert from percentage;&lt;br /&gt;months = 0;&lt;br /&gt;start = 1;&lt;br /&gt;do while (start &amp;lt; 2);&lt;br /&gt;start = start * (1 + mrate);&lt;br /&gt;months + 1;&lt;br /&gt;end;&lt;br /&gt;years = months / 12;&lt;br /&gt;output;&lt;br /&gt;end;&lt;br /&gt;keep rate years;&lt;br /&gt;run;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Iterative Do-loops: Example 2&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Suppose we have a record of the number of classes students take in&lt;br /&gt;each year of college, stored in variables class1-class5. We want&lt;br /&gt;to find out how long it takes students to take 10 classes:&lt;br /&gt;data ten;&lt;br /&gt;set classes;&lt;br /&gt;array class class1-class5;&lt;br /&gt;total = 0;&lt;br /&gt;do i = 1 to dim(class) until(total &amp;gt;= 10);&lt;br /&gt;total = total + class{i};&lt;br /&gt;end;&lt;br /&gt;year = i;&lt;br /&gt;if total lt 10 then year = .;&lt;br /&gt;drop i total;&lt;br /&gt;run;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Getting out of Do-loops&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;There are two options for escaping a do-loop before its normal&lt;br /&gt;termination:&lt;br /&gt;You can use a goto statement to jump outside the loop:&lt;br /&gt;count = 0;&lt;br /&gt;do i=1 to 10;&lt;br /&gt;if x{i} = . then count = count + 1;&lt;br /&gt;if count &amp;gt; 5 then goto done:&lt;br /&gt;end;&lt;br /&gt;done: if count &amp;lt; 5 then output;&lt;br /&gt;. . .&lt;br /&gt;You can also force termination of a do-loop by modifying the value&lt;br /&gt;of the index variable. Use with caution since it can create an&lt;br /&gt;infinite loop.&lt;br /&gt;do i=1 to 10;&lt;br /&gt;if x{i} = . then count = count + 1;&lt;br /&gt;if count &amp;gt; 5 then i=10;&lt;br /&gt;end;&lt;br /&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;SAS Functions: Mathematical&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Each function takes a single argument, and may return a missing&lt;br /&gt;value (.) if the function is not defined for that argument.&lt;br /&gt;Name Function Name Function&lt;br /&gt;abs absolute value arcos arccosine&lt;br /&gt;digamma digamma function arsin arcsin&lt;br /&gt;erf error function atan arctangent&lt;br /&gt;exp power of e (2.71828 · · ·) cos cosine&lt;br /&gt;gamma gamma function cosh hyperbolic cosine&lt;br /&gt;lgamma log of gamma sin sine&lt;br /&gt;log log (base e) sinh hyperbolic sine&lt;br /&gt;log2 log (base 2) tan tangent&lt;br /&gt;log10 log (base 10) tanh hyperbolic tangent&lt;br /&gt;sign returns sign or zero&lt;br /&gt;sqrt square root&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;SAS Functions: Statistical Summaries&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The statistical summary functions accept unlimited numbers of&lt;br /&gt;arguments, and ignore missing values.&lt;br /&gt;Name Function Name Function&lt;br /&gt;css corrected range maximium − minimum&lt;br /&gt;sum of squares skewness skewness&lt;br /&gt;cv coefficient std standard deviation&lt;br /&gt;of variation stderr standard error&lt;br /&gt;kurtosis kurtosis of the mean&lt;br /&gt;max maximum sum sum&lt;br /&gt;mean mean uss uncorrected&lt;br /&gt;median median sum of squares&lt;br /&gt;min minimun var variance&lt;br /&gt;pctl percentiles&lt;br /&gt;In addition, the function ordinal(n,...) gives the nth ordered&lt;br /&gt;value from its list of arguments.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Using Statistical Summary Functions&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;You can use variable lists in all the statistical summary functions&lt;br /&gt;by preceding the list with the word “of”; for example:&lt;br /&gt;xm = mean(of x1-x10);&lt;br /&gt;vmean = mean(of thisvar -- thatvar);&lt;br /&gt;Without the of, the single dash is interpreted in its usual way, that&lt;br /&gt;is as a minus sign or the unary minus operator; thus&lt;br /&gt;xm = mean(of x1-x10);&lt;br /&gt;is the same as&lt;br /&gt;xm = mean(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10);&lt;br /&gt;but&lt;br /&gt;xm1 = mean(x1-x10);&lt;br /&gt;calculates the mean of x1 minus x10, and&lt;br /&gt;xm2 = mean(x1--x10);&lt;br /&gt;calculates the mean of x1 plus x10.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Concatenating Character Strings&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;SAS provides the following functions for joining together character&lt;br /&gt;strings:&lt;br /&gt;cat - preserve all spaces&lt;br /&gt;cats - remove trailing blanks&lt;br /&gt;catt - remove all blanks&lt;br /&gt;catx - join with separator (first argument)&lt;br /&gt;Each function accepts an unlimited number of arguments. To join&lt;br /&gt;together all the elements in a variable list, use the of keyword:&lt;br /&gt;x1 = ’one’;&lt;br /&gt;x2 = ’two’;&lt;br /&gt;x3 = ’three’;&lt;br /&gt;all = catx(’ ’,of x1-x3); * or catx(’ ’,x1,x2,x3);&lt;br /&gt;The variable all will have the value ’one two three’&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;SAS Functions: Character Manipulation&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;compress(target,&amp;lt;chars-to-remove&amp;gt;)&lt;br /&gt;expr = &quot;one, two: three:&quot;;&lt;br /&gt;new = compress(expr,&quot;,:&quot;); *new =&amp;gt; &quot;one two three&quot;&lt;br /&gt;With no second argument compress removes blanks.&lt;br /&gt;count(string,substring) - counts how many times substring&lt;br /&gt;appears in string&lt;br /&gt;index(source,string) - finds position of string in source&lt;br /&gt;where = &quot;university of california&quot;;&lt;br /&gt;i = index(where,&quot;cal&quot;); * i =&amp;gt; 15&lt;br /&gt;indexc(source,string) - finds position of any character in&lt;br /&gt;string in source&lt;br /&gt;where = &quot;berkeley, ca&quot;;&lt;br /&gt;i = indexc(where,&quot;abc&quot;); * i=1 (b is in position 1);&lt;br /&gt;index and indexc return 0 if there is no match&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;SAS Functions: Character Manipulation (cont’d)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;left(string) - returns a left-justified character variable&lt;br /&gt;length(string) - returns number of characters in a string&lt;br /&gt;length returns 1 if string is missing, 12 if string is uninitialized&lt;br /&gt;repeat(string,n) - repeats a character value n times&lt;br /&gt;reverse(string) - reverses the characters in a character variable&lt;br /&gt;right(string) - returns a right-justified character variable&lt;br /&gt;scan(string,n,&amp;lt;delims&amp;gt;) - returns the nth “word” in string&lt;br /&gt;field = &quot;smith, joe&quot;;&lt;br /&gt;first = scan(field,2,&quot; ,&quot;); * first will be ’joe’;&lt;br /&gt;negative numbers count from right to left.&lt;br /&gt;substr(string,position,&amp;lt;n&amp;gt;) - returns pieces of a variable&lt;br /&gt;field = &quot;smith, joe&quot;;&lt;br /&gt;last = substr(field,1,index(field,&quot;,&quot;) - 1);&lt;br /&gt;results in last equal to &quot;smith&quot;.&lt;br /&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;SAS Functions: Character Manipulation (cont’d)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;translate(string,to,from) - changes from chars to to chars&lt;br /&gt;word = &quot;eXceLLent&quot;;&lt;br /&gt;new = translate(word,&quot;xl&quot;,&quot;XL&quot;); *new =&amp;gt; &quot;excellent&quot;;&lt;br /&gt;transwrd(string,old,new) - changes old to new in string&lt;br /&gt;trim(string) - returns string with leading blanks removed&lt;br /&gt;upcase(string) - converts lowercase to uppercase&lt;br /&gt;verify(source,string) - return position of first char. in source&lt;br /&gt;which is not in string&lt;br /&gt;check = verify(val,&quot;0123456789.&quot;);&lt;br /&gt;results in check equal to 0 if val is a character string containing&lt;br /&gt;only numbers and periods.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Regular Expressions in SAS&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The prxmatch and prxchange functions allow the use of&lt;br /&gt;Perl-compliant regular expressions in SAS programs. For example,&lt;br /&gt;to find the location of the first digit followed by a blank in a&lt;br /&gt;character string, the following code could be used:&lt;br /&gt;str = ’275 Main Street’;&lt;br /&gt;wh = prxmatch(’/\d /’,str); * wh will be equal to 3;&lt;br /&gt;To reverse the order of two names separated by commas, the&lt;br /&gt;following could be used:&lt;br /&gt;str = ’Smith, John’;&lt;br /&gt;newstr = prxchange(’s/(\w+?), (\w+?)/$2 $1/’,-1,str);&lt;br /&gt;The second argument is the number of changes to make; −1 means&lt;br /&gt;to change all occurences.&lt;br /&gt;For more efficiency, regular expresssions can be precompiled using&lt;br /&gt;the prxparse function.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;SAS Functions for Random Number Generation&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Each of the random number generators accepts a seed as its first&lt;br /&gt;argument. If this value is greater than 0, the generator produces a&lt;br /&gt;reproducible sequence of values; otherwise, it takes a seed from the&lt;br /&gt;system clock and produces a sequence which can not be reproduced.&lt;br /&gt;The two most common random number functions are&lt;br /&gt;ranuni(seed) - uniform variates in the range (0, 1), and&lt;br /&gt;rannor(seed) - normal variates with mean 0 and variance 1.&lt;br /&gt;Other distributions include binomial (ranbin), Cauchy (rancau),&lt;br /&gt;exponential (ranexp), gamma (rangam), Poisson (ranpoi), and&lt;br /&gt;tabled probability functions (rantbl).&lt;br /&gt;For more control over the output of these generators, see the&lt;br /&gt;documention for the corresponding call routines, for example call&lt;br /&gt;ranuni.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Generating Random Numbers&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The following example, which uses no input data, creates a data set&lt;br /&gt;containing simulated data. Note the use of ranuni and the int&lt;br /&gt;function to produce a categorical variable (group) with&lt;br /&gt;approximately equal numbers of observations in each category.&lt;br /&gt;data sim;&lt;br /&gt;do i=1 to 100;&lt;br /&gt;group = int(5 * ranuni(12345)) + 1;&lt;br /&gt;y = rannor(12345);&lt;br /&gt;output;&lt;br /&gt;end;&lt;br /&gt;keep group y;&lt;br /&gt;run;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Creating Multiple Data Sets&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;To create more than one data set in a single data step, list the&lt;br /&gt;names of all the data sets you wish to create on the data statement.&lt;br /&gt;When you have multiple data set names on the data statement&lt;br /&gt;observations will be automatically output to all the data sets unless&lt;br /&gt;you explicitly state the name of the data set in an output&lt;br /&gt;statement.&lt;br /&gt;data young old;&lt;br /&gt;set all;&lt;br /&gt;if age &amp;lt; 25 then output young;&lt;br /&gt;else output old;&lt;br /&gt;run;&lt;br /&gt;Note: If your goal is to perform identical analyses on subgroups of&lt;br /&gt;the data, it is usually more efficient to use a by statement or a&lt;br /&gt;where statement.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Subsetting Observations&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Although the subsetting if is the simplest way to subset&lt;br /&gt;observations you can actively remove observations using a delete&lt;br /&gt;statement, or include observations using a output statement.&lt;br /&gt;• delete statement&lt;br /&gt;if reason = 99 then delete;&lt;br /&gt;if age &amp;gt; 60 and sex = &quot;F&quot; then delete;&lt;br /&gt;No further processing is performed on the current observation&lt;br /&gt;when a delete statement is encountered.&lt;br /&gt;• output statement&lt;br /&gt;if reason ^= 99 and age &amp;lt; 60 then output;&lt;br /&gt;if x &amp;gt; y then output;&lt;br /&gt;Subsequent statements are carried out (but not reflected in the&lt;br /&gt;current observation). When a data step contains one or more&lt;br /&gt;output statements, SAS’ usual automatic outputting at the end&lt;br /&gt;of each data step iteration is disabled — only observations&lt;br /&gt;which are explicitly output are included in the data set.&lt;br /&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Random Access of Observations&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;In the usual case, SAS automatically processes each observation in&lt;br /&gt;sequential order. If you know the position(s) of the observation(s)&lt;br /&gt;you want in the data set, you can use the point= option of the set&lt;br /&gt;statement to process only those observations.&lt;br /&gt;The point= option of the set statement specifies the name of a&lt;br /&gt;temporary variable whose value will determine which observation&lt;br /&gt;will be read. When you use the point= option, SAS’ default&lt;br /&gt;behavior of automatically looping through the data set is disabled,&lt;br /&gt;and you must explicitly loop through the desired observations&lt;br /&gt;yourself, and use the stop statement to terminate the data step.&lt;br /&gt;The following example also makes use of the nobs= option of the&lt;br /&gt;set statement, which creates a temporary variable containing the&lt;br /&gt;number of observations contained in the data set.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Random Access of Observations: Example&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The following program reads every third observation from the data&lt;br /&gt;set big:&lt;br /&gt;data sample;&lt;br /&gt;do obsnum = 1 to total by 3;&lt;br /&gt;set big point=obsnum nobs=total;&lt;br /&gt;if _error_ then abort;&lt;br /&gt;output;&lt;br /&gt;end;&lt;br /&gt;stop;&lt;br /&gt;run;&lt;br /&gt;Note that the set statement is inside the do-loop. If an attempt is&lt;br /&gt;made to read an invalid observation, SAS will set the automatic&lt;br /&gt;variable error to 1. The stop statement insures that SAS does&lt;br /&gt;not go into an infinite loop;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Application: Random Sampling I&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Sometimes it is desirable to use just a subsample of your data in an&lt;br /&gt;analysis, and it is desired to extract a random sample, i.e. one in&lt;br /&gt;which each observation is just as likely to be included as each other&lt;br /&gt;observation. If you want a random sample where you don’t control&lt;br /&gt;the exact number of observations in your sample, you can use the&lt;br /&gt;ranuni function in a very simple fashion. Suppose we want a&lt;br /&gt;random sample consisting of roughly 10% of the observations in a&lt;br /&gt;data set. The following program will randomly extract the sample:&lt;br /&gt;data sample;&lt;br /&gt;set giant;&lt;br /&gt;if ranuni(12345) &amp;lt; .1;&lt;br /&gt;run;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Application: Random Sampling II&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Now suppose we wish to randomly extract exactly n observations&lt;br /&gt;from a data set. To insure randomness, we must adjust the fraction&lt;br /&gt;of observations chosen depending on how many observations we&lt;br /&gt;have already chosen. This can be done using the nobs= option of&lt;br /&gt;the set statement. For example, to choose exactly 15 observations&lt;br /&gt;from a data set all, the following code could be used:&lt;br /&gt;data some;&lt;br /&gt;retain k 15 n ;&lt;br /&gt;drop k n;&lt;br /&gt;set all nobs=nn;&lt;br /&gt;if _n_ = 1 then n = nn;&lt;br /&gt;if ranuni(0) &amp;lt; k / n then do;&lt;br /&gt;output;&lt;br /&gt;k = k - 1;&lt;br /&gt;end;&lt;br /&gt;if k = 0 then stop;&lt;br /&gt;n = n - 1;&lt;br /&gt;run;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Application: Random Sampling III&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The point= option of the set statement can often be used to create&lt;br /&gt;many random samples efficiently. The following program creates&lt;br /&gt;1000 samples of size 10 from the data set big , using the variable&lt;br /&gt;sample to identify the different samples in the output data set:&lt;br /&gt;data samples;&lt;br /&gt;do sample=1 to 1000;&lt;br /&gt;do j=1 to 10;&lt;br /&gt;r = round(ranuni(1) * nn);&lt;br /&gt;set big point=r nobs=nn;&lt;br /&gt;output;&lt;br /&gt;end;&lt;br /&gt;end;&lt;br /&gt;stop;&lt;br /&gt;drop j;&lt;br /&gt;run;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;By Processing in Procedures&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;In procedures, the by statement of SAS allows you to perform&lt;br /&gt;identical analyses for different groups in your data. Before using a&lt;br /&gt;by statement, you must make sure that the data is sorted (or at&lt;br /&gt;least grouped) by the variables in the by statement.&lt;br /&gt;The form of the by statement is&lt;br /&gt;by &amp;lt;descending&amp;gt; variable-1 · · · &amp;lt;&amp;lt;descending&amp;gt; variable-n &amp;lt;notsorted&amp;gt;&amp;gt;;&lt;br /&gt;By default, SAS expects the by variables to be sorted in ascending&lt;br /&gt;order; the optional keyword descending specifies that they are in&lt;br /&gt;descending order.&lt;br /&gt;The optional keyword notsorted at the end of the by statement&lt;br /&gt;informs SAS that the observations are grouped by the by variables,&lt;br /&gt;but that they are not presented in a sorted order. Any time any of&lt;br /&gt;the by variables change, SAS interprets it as a new by group.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Selective Processing in Procedures: where statement&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;When you wish to use only some subset of a data set in a&lt;br /&gt;procedure, the where statement can be used to select only those&lt;br /&gt;observations which meet some condition. There are several ways to&lt;br /&gt;use the where statement.&lt;br /&gt;As a procedure statement: As a data set option:&lt;br /&gt;proc reg data=old; proc reg data=old(where = (sex eq ’M’));&lt;br /&gt;where sex eq ’M’; model y = x;&lt;br /&gt;model y=x; run;&lt;br /&gt;run;&lt;br /&gt;In the data step:&lt;br /&gt;data survey;&lt;br /&gt;input id q1-q10;&lt;br /&gt;where q2 is not missing and q1 &amp;lt; 4;&lt;br /&gt;data new;&lt;br /&gt;set old(where = (group = ’control’));&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;where statement: Operators&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Along with all the usual SAS operators, the following are available&lt;br /&gt;in the where statement:&lt;br /&gt;between/and - specify a range of observations&lt;br /&gt;where salary between 20000 and 50000;&lt;br /&gt;contains - select based on strings contained in character variables&lt;br /&gt;where city contains ’bay’;&lt;br /&gt;is missing - select based on regular or special missing value&lt;br /&gt;where x is missing and y is not missing;&lt;br /&gt;like - select based on patterns in character variables&lt;br /&gt;(Use % for any number of characters, _ for exactly one)&lt;br /&gt;where name like ’S%’;&lt;br /&gt;sounds like (=*) - select based on soundex algorithm&lt;br /&gt;where name =* ’smith’;&lt;br /&gt;You can use the word not with all of these operators to reverse the&lt;br /&gt;sense of the comparison.&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/6295434354364487638/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2013/11/review-introduction-to-sas-system-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/6295434354364487638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/6295434354364487638'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2013/11/review-introduction-to-sas-system-part-1.html' title='Review: An Introduction to the SAS System Part-1'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-3573299234623401234</id><published>2013-09-18T13:58:00.000+05:30</published><updated>2013-09-18T13:58:38.630+05:30</updated><title type='text'>SAS programming in Mainframe </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;&lt;u&gt;&lt;i&gt;Abstract&lt;/i&gt;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;Versions 8 and 9 of the SAS System have included many enhancements that are typically enjoyed by users of the PC platform. While working on a major overhaul of one of our reporting systems, we discovered many features of SAS that worked very well on the Mainframe, but were not widely known. This paper illustrates a few ‘modern’ tools that SAS Programmers can use in the Mainframe environment to move their systems forward into 21st Century techniques and applications. We will take a quick look at generating PDF files, using the SAS FTP access method, and generating e.mails, all from the z/OS (Mainframe) environment.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;OUTPUT DELIVERY SYSTEM&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
One of the most significant developments in Version 7 of SAS was the inclusion of the Output Delivery System, or&lt;br /&gt;
ODS. Greatly enhanced in Versions 8 and 9, ODS allows users to create customized versions of output in a variety&lt;br /&gt;
of destinations (including HTML, RTF, XML, and PDF) instead of being limited to traditional line-listing printouts. For&lt;br /&gt;
flexibility and convenience, we have converted many of our reports to PDF format.&lt;br /&gt;
Generating default (unenhanced) PDF files is fairly simple with ODS, but there can be a lot of extra work involved in&lt;br /&gt;
making minor changes to the default PDF generator. SAS includes a number of ‘styles’ for generating ODS output.&lt;br /&gt;
Styles are collections of parameters that tell SAS how to format output by specifying fonts, colors, margins, and many&lt;br /&gt;
other attributes. You can also modify existing styles to suit your needs, but that is beyond the scope of this paper. A&lt;br /&gt;
copy of one of our customized styles is included as an appendix.&lt;br /&gt;
Simple ODS output can be accomplished by ‘wrapping’ your existing SAS program with a few lines of code. Before&lt;br /&gt;
your procedures, you will need to code at least 3 statements:&lt;br /&gt;
1 FILENAME, which creates a file reference name (fileref) and allocates space for your PDF file on the&lt;br /&gt;
Mainframe.&lt;br /&gt;
2 ODS LISTING CLOSE, which closes the default LISTING destination. It is recommended to keep open only&lt;br /&gt;
the specific destinations you are sending output to.&lt;br /&gt;
3 ODS PDF, which opens the PDF destination, and provides SAS with additional details about the file that you&lt;br /&gt;
are generating.&lt;br /&gt;
There are other ODS statements and SAS options that you may find useful to include in this initialization section.&lt;br /&gt;
Here is a sample of some code used to initiate a PDF job:&lt;br /&gt;
1 FILENAME OUTPDF &quot;KJK4.FDWCTNAT&quot; DISP=NEW UNIT=TEMP RECFM=VB LRECL=259;&lt;br /&gt;
2 ODS LISTING CLOSE;&lt;br /&gt;
3 OPTIONS ORIENTATION=LANDSCAPE;&lt;br /&gt;
4 ODS NOPTITLE;&lt;br /&gt;
5 ODS PATH SASHELP.TMPLMST (READ) NEWTEMP.TEMPLAT (READ);&lt;br /&gt;
6 ODS ESCAPECHAR=&#39;^&#39;;&lt;br /&gt;
7 ODS PDF FILE=OUTPDF STYLE=STYLES.TEST1 NOTOC;&lt;br /&gt;
Code Explanation:&lt;br /&gt;
Line 1 These are the recommended Data Control Block (DCB) parameters from SAS when defining a PDF file&lt;br /&gt;
on the Mainframe. On this particular system, UNIT=TEMP will automatically delete the file after 3 to 8&lt;br /&gt;
days, depending on the file size.&lt;br /&gt;
Line 2 Before generating output with ODS, you should close the default LISTING destination.&lt;br /&gt;
Line 3 ODS output uses portrait layout unless otherwise specified.&lt;br /&gt;
SUGI 30 Coders&#39; Corner2&lt;br /&gt;
Line 4 This optional statement suppresses the printing of the default procedure name in your output.&lt;br /&gt;
Line 5 This statement is only necessary if you have defined your own ODS Style templates, and refers to your&lt;br /&gt;
own Template store; if you are using one of the built-in styles, you can omit it.&lt;br /&gt;
Line 6 This optional statement defines a special character not present in your dataset that can allow you to add&lt;br /&gt;
very specific in-line formatting inside of some of your procedure code.&lt;br /&gt;
Line 7 This is the primary statement that initiates the generation of your PDF file, and refers to the FILENAME&lt;br /&gt;
statement (Line 1) specified earlier. The STYLE parameter refers to the desired ODS style you want&lt;br /&gt;
used for your output. This example refers to a user-defined ODS template called TEST1. The NOTOC&lt;br /&gt;
option suppresses the automatic generation of the PDF Table of Contents.&lt;br /&gt;
Remember that only statements 1, 2, and 7 are required to generate your ODS code.&lt;br /&gt;
Following these statements, any output generated from SAS Procedures will be directed to the ODS destination.&lt;br /&gt;
After your last output procedure, you can then close your ODS destination with just two lines of code:&lt;br /&gt;
8 ODS PDF CLOSE;&lt;br /&gt;
9 ODS LISTING;&lt;br /&gt;
Line 8 This statement is issued after the final data step boundary (make sure to include a RUN statement after&lt;br /&gt;
your final procedure, before this statement) to end the generation of your PDF file.&lt;br /&gt;
Line 9 This statement re-opens the default destination, and is good practice to include after closing another&lt;br /&gt;
ODS destination.&lt;br /&gt;
The capability to generate PDF files was put into production for the Mainframe in Version 8.1, although the files&lt;br /&gt;
generated were quite large. Improved compression for PDF files was introduced in Version 9.0, which was used for&lt;br /&gt;
&lt;br /&gt;
the code in this paper.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;SAS FTP ACCESS METHOD&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
Once you have created your ODS output on the Mainframe, you have a number of options to move that file&lt;br /&gt;
somewhere where it can be easily accessed by you and your users.&lt;br /&gt;
Within your mainframe terminal emulation software, there may be an option to directly transfer files, or you may have&lt;br /&gt;
a standalone software package (such as WS_FTP) that can be used. If you have worked with UNIX System Services&lt;br /&gt;
on the Mainframe, and have access to a web-served directory on the system, you can actually create PDF files on&lt;br /&gt;
the Mainframe that can be directly browsed by Internet Explorer, without having to transfer the files.&lt;br /&gt;
We opted to use the SAS built-in method of transferring files via FTP. The process is fairly simple, and is&lt;br /&gt;
accomplished through the FILENAME statement. To use this method, you will need access to an active FTP server.&lt;br /&gt;
Here is a sample FILENAME statement:&lt;br /&gt;
FILENAME OUTFTP FTP&lt;br /&gt;
&amp;nbsp;&quot;TESTFILE.TXT&quot;&lt;br /&gt;
&amp;nbsp;CD=&quot;/home/kjk4/public_html&quot;&lt;br /&gt;
&amp;nbsp;HOST=”111.111.111.111”&lt;br /&gt;
&amp;nbsp;USER=&quot;kjk4&quot;&lt;br /&gt;
&amp;nbsp;PASS=”password”&lt;br /&gt;
&amp;nbsp;RECFM=S&lt;br /&gt;
&amp;nbsp;DEBUG;&lt;br /&gt;
While the syntax for the FTP Filename statement is quite different from typical FILENAME statements on the&lt;br /&gt;
Mainframe, the parameters that are coded are fairly standard.&lt;br /&gt;
After the FILENAME statement, code a fileref that you will refer to later. In this example, OUTFTP is the fileref. FTP&lt;br /&gt;
is then coded to indicate to SAS that you will be using File Transfer Protocol with this file. Next, list the name of the&lt;br /&gt;
file that you will be creating on the remote host. The naming conventions of the destination should be used when&lt;br /&gt;
specifying the filename.&lt;br /&gt;
In this example, we are transferring data to a Linux server, so the options that are shown here may or may not apply&lt;br /&gt;
to other destinations you may use. The SAS Language Reference documentation for “FILENAME, FTP Access&lt;br /&gt;
Method” explains all of the different options available for this statement. Since the Linux operating system is case-sensitive, we had to issue a “CAPS OFF” mainframe command in our ISPF&lt;br /&gt;
edit session, and make sure that we were not using the CAPS option anywhere in our program. This preserves&lt;br /&gt;
lower-case letters in the SAS programs. Depending on your remote destination, this may be necessary to do in your&lt;br /&gt;
programs as well.&lt;br /&gt;
We use the CD command to change the directory of the destination to point to the remote location where we want to&lt;br /&gt;
store our file. HOST is the network name of the destination server. It can be specified using an IP address or the&lt;br /&gt;
actual host name.&lt;br /&gt;
USER and PASS specify the UserID and associated Password for access to the remote FTP server. RECFM=S sets&lt;br /&gt;
the record format type, creating a binary data transfer. The DEBUG option prints log messages from the actual FTP&lt;br /&gt;
login on the remote server to your SAS Mainframe log.&lt;br /&gt;
Notice that even though we are in the Mainframe environment, we did not have to specify any of the typical keywords&lt;br /&gt;
associated with a fileref on the Mainframe, such as LRECL, DISP, or SPACE. The SAS internal FTP client transfers&lt;br /&gt;
the file to the remote destination, and no permanent file is written to the Mainframe.&lt;br /&gt;
Once you have coded your FILENAME statement, you can use that fileref just as you would in any statement that&lt;br /&gt;
generates an output file:&lt;br /&gt;
DATA _NULL_;&lt;br /&gt;
&amp;nbsp;SET ONE;&lt;br /&gt;
&amp;nbsp;FILE OUTFTP;&lt;br /&gt;
&amp;nbsp;PUT …&lt;br /&gt;
Or, you could combine it with ODS code presented earlier, and have the Mainframe generate the PDF file and&lt;br /&gt;
automatically transfer it to your remote system. Since the file is never actually stored on the mainframe, it is not&lt;br /&gt;
necessary to code any DCB parameters in this FILENAME statement.&lt;br /&gt;
FILENAME OUTPDF FTP &quot;TESTFILE.PDF&quot;&lt;br /&gt;
&amp;nbsp;CD=&quot;/home/kjk4/public_html&quot;&lt;br /&gt;
&amp;nbsp;HOST=”111.111.111.111”&lt;br /&gt;
&amp;nbsp;USER=&quot;kjk4&quot;&lt;br /&gt;
&amp;nbsp;PASS=”password”&lt;br /&gt;
&amp;nbsp;RECFM=S&lt;br /&gt;
&amp;nbsp;DEBUG;&lt;br /&gt;
ODS PDF FILE=OUTFTP STYLE=STYLES.TEST1 NOTOC;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;MAINFRAME-GENERATED E.MAIL&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;
Our Mainframe offers the capability to generate automated e.mail messages from within SAS programs, and can also&lt;br /&gt;
include attachments and links to files. We began by trying to send files as attachments, but because of size&lt;br /&gt;
limitations, we abandoned this method for our project, and instead use e.mail to notify users that files have been&lt;br /&gt;
created and stored on local servers. These automated e.mails contain hyperlinks to the files, and allows users to&lt;br /&gt;
quickly access reports in an electronic format. This feature is experimental in Version 8, and production in Version 9,&lt;br /&gt;
where it is documented.&lt;br /&gt;
First, we show code on how to send an e.mail from the Mainframe, and then explain how to send different&lt;br /&gt;
attachments.&lt;br /&gt;
E.mails are also generated on the Mainframe through use of the FILENAME statement. Here is some sample code&lt;br /&gt;
for generating a plain text message:&lt;br /&gt;
FILENAME OUTBOX EMAIL&lt;br /&gt;
&amp;nbsp;TO=(’KJK4@XYZ.GOV’ ‘ZQQ8@XYZ.GOV’)&lt;br /&gt;
&amp;nbsp;REPLYTO=&#39;TBE2@XYZ.GOV&#39;&lt;br /&gt;
&amp;nbsp;TYPE=&#39;TEXT/PLAIN&#39;&lt;br /&gt;
&amp;nbsp;SUBJECT=&quot;Your file is ready&quot;;&lt;br /&gt;
SUGI 30 Coders&#39; Corner4&lt;br /&gt;
In this example, OUTBOX is our fileref for the e.mail that we are going to generate, and EMAIL is the keyword to tell&lt;br /&gt;
SAS that this file is an e.mail to be sent via SMTP. The TO parameter denotes the e.mail address(es) of the&lt;br /&gt;
recipients for the e.mail. If you have a single recipient, you may omit the parentheses. You can also code CC= in the&lt;br /&gt;
same manner if you want to send copies of the message to other users.&lt;br /&gt;
By default, the FROM address on messages generated by the Mainframe will not look like a standard e.mail address.&lt;br /&gt;
In addition, there’s probably not a mailbox on that end that you can access. It is good practice to use the REPLYTO&lt;br /&gt;
parameter with an address you can access so that if there are problems, users can easily contact you. Note that if&lt;br /&gt;
delivery of a message fails, you may or may not get any type of error in your log, depending on other JCL settings in&lt;br /&gt;
your job. While we have had very good success with our system, we frequently include developers’ e.mail addresses&lt;br /&gt;
in the list of recipients to monitor performance of the system and make certain that there are no problems.&lt;br /&gt;
We code TYPE to make sure that SAS will send the file as plain text. The SUBJECT keyword is optional, but&lt;br /&gt;
recommended, and values inside quotation marks will have their case preserved.&lt;br /&gt;
Once you have issued your FILENAME command, you can then generate an e.mail using PUT statements inside a&lt;br /&gt;
DATA _NULL_ step, like this:&lt;br /&gt;
OPTIONS NOCAPS;&lt;br /&gt;
DATA _NULL_;&lt;br /&gt;
&amp;nbsp;FILE OUTBOX;&lt;br /&gt;
&amp;nbsp;PUT &quot;The report listed above is now available via the following&quot;;&lt;br /&gt;
&amp;nbsp;PUT &quot;link for 21 days:&quot;;&lt;br /&gt;
&amp;nbsp;PUT / &quot;http://111.111.111.111/~kjk4/testfile.pdf&quot;;&lt;br /&gt;
&amp;nbsp;PUT // &quot;Thanks,&quot;;&lt;br /&gt;
&amp;nbsp;PUT &quot;KJK4&quot;;&lt;br /&gt;
RUN;&lt;br /&gt;
The NOCAPS option makes sure to preserve the lower case letters in the body of the message. This is necessary&lt;br /&gt;
when including hyperlinks that point to a file stored on a case-sensitive system. The FILE statement tells SAS to&lt;br /&gt;
refer to the OUTBOX fileref, which alerts the system that this is an e.mail. Then, PUT statements are used to specify&lt;br /&gt;
the text. Our e.mail system, Outlook, automatically recognizes the third line of this e.mail as a hyperlink, and allows&lt;br /&gt;
the recipient to click on it to access the file specified.&lt;br /&gt;
Attachments can also be sent by e.mail, although the maximum attachment size allowed by our Mainframe is 500KB.&lt;br /&gt;
This maximum is set by an IBM SMTP Configuration File, and is independent of SAS. Text, PDF, HTML, and other&lt;br /&gt;
types of files can be sent via e.mail.&lt;br /&gt;
To send an attachment, you will need to have already created a file on the Mainframe, using a standard fileref earlier&lt;br /&gt;
in your program. Then, you simply add one additional option to your FILENAME EMAIL statement that denotes the&lt;br /&gt;
attachment:&lt;br /&gt;
ATTACH=(&quot;KJK4.T1030.TXT” NAME=”KJK4”);&lt;br /&gt;
This statement attaches a text file that is named KJK4.T1030.TXT on the Mainframe. Since PC users may be&lt;br /&gt;
confused by a 3-level file name, I can use the NAME= option to specify a new name for the file, to which SAS&lt;br /&gt;
automatically adds the correct file type extension. So, the above statement sends the file KJK4.T1030.TXT as an&lt;br /&gt;
attachment, but in the e.mail, it appears as a file named KJK4.TXT.&lt;br /&gt;
This statement attaches a PDF file directly to the e.mail message:&lt;br /&gt;
ATTACH=(&quot;KJK4.T1030” CT=&#39;APPLICATION/PDF&#39; EXT=&#39;PDF&#39;);&lt;br /&gt;
Since we have coded the EXT keyword, the Mainframe attaches the file denoted by the filename in quotes, and adds&lt;br /&gt;
the extension, which becomes KJK4.T1030.PDF in this case. The CT parameter specifies to the receiver’s e.mail&lt;br /&gt;
system what to do when the attachment is opened. With the value of ‘APPLICATION/PDF’, the recipient’s e.mail&lt;br /&gt;
program should automatically open the attachment in Adobe Acrobat when clicked.&lt;br /&gt;
The syntax for sending attachments is not always obvious, but there are a number of examples located on the SAS&lt;br /&gt;
&lt;br /&gt;
website, and in SUGI papers. The documentation for Version 9 also gives additional examples.&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/3573299234623401234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2013/09/sas-programming-in-mainframe.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/3573299234623401234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/3573299234623401234'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2013/09/sas-programming-in-mainframe.html' title='SAS programming in Mainframe '/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-8990636644803700345</id><published>2012-09-02T11:42:00.003+05:30</published><updated>2012-09-02T11:42:44.090+05:30</updated><title type='text'>Lesson 7:  Data Set Options, Set and Merge Statements</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Data Set Options&lt;/b&gt;&lt;br /&gt;
&quot;Options&quot; are used in SAS in various places, and with various different kinds of syntax.&amp;nbsp; For this reason, the concept of options can be a bit confusing.&amp;nbsp; An earlier lesson introduced the idea of a global system options statement, where we can set things like linesize, page numbering, and so forth.&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;Data set option&lt;/b&gt;s&lt;/span&gt;&amp;nbsp;are something different.&amp;nbsp; They are commands added to a basic data step statement to refine or modify the work of the data step, or they can be used to modify how a data set is used in a proc step.&amp;nbsp; (The term, &quot;options,&quot; is also used for any optional command in any SAS statement.&amp;nbsp; This is why we have to distinguish between system options, data set options, and other options.)&lt;br /&gt;
We begin with the&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;drop&lt;/b&gt;&lt;/span&gt;&amp;nbsp;and&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;keep&lt;/b&gt;&lt;/span&gt;&amp;nbsp;options.&amp;nbsp; The examples below show how these two options can be used to accomplish the same thing.&amp;nbsp; The choice between them is purely a matter of convenience.&amp;nbsp; The drop option lists the variables to be omitted from the data set, while the keep option lists those which are to remain in the data set.&amp;nbsp; There could be many reasons why you might not want all of the original variables in your data set.&amp;nbsp; In the next example, we use the original variables for calculations, but do not include them in the data set.&amp;nbsp; In other cases, we may create variables that are only used in the program and do not need to be saved.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;342&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS07/SAS7.07.gif&quot; width=&quot;319&quot; /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img border=&quot;0&quot; height=&quot;341&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS07/SAS7.08.gif&quot; width=&quot;319&quot; /&gt;&lt;br /&gt;
Take note of the syntax used here, as it is unique for data set options.&amp;nbsp; All the options to be applied to a particular data set are enclosed in parentheses, following the name of the data set to which they apply.&amp;nbsp; An equal sign after each option is followed by the list of items involved.&amp;nbsp; Here they are part of the data step, but they are NOT called DATA STEP options, but rather DATA SET options, and they can be used any time a data set is referenced, such as in this proc print statement:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;231&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS07/SAS7.09.gif&quot; width=&quot;355&quot; /&gt;&lt;br /&gt;
(A var statement under proc print would be more appropriate, but this works. Var statements are covered later.)&lt;br /&gt;
&lt;b&gt;The Set Statement&lt;/b&gt;&lt;br /&gt;
The&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;set statement&lt;/span&gt;&lt;/b&gt;&amp;nbsp; is used to create a new data set from an existing one.&amp;nbsp; In the simplest example, it merely copies a data set. The following program will create a new data set called&amp;nbsp;&lt;i&gt;two&lt;/i&gt;&amp;nbsp;that is an exact copy of&amp;nbsp;&lt;i&gt;one&lt;/i&gt;, providing&amp;nbsp;&lt;i&gt;one&lt;/i&gt;&amp;nbsp;exists.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;87&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS12/SAS12.h1.gif&quot; width=&quot;197&quot; /&gt;&lt;br /&gt;
Now suppose that a data set called&amp;nbsp;&lt;i&gt;one&lt;/i&gt;&amp;nbsp;has been created, as shown in the data step below, and that you later wanted to create a new data set called&amp;nbsp;&lt;i&gt;two&lt;/i&gt;, with some new variables, but leaving the old&amp;nbsp;&lt;i&gt;one&lt;/i&gt;unchanged.&amp;nbsp; The set statement can be used to copy the original data set and add new variables.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;243&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS12/SAS12.h2.gif&quot; width=&quot;281&quot; /&gt;&lt;br /&gt;
SAS will now go through all the observations in&amp;nbsp;&lt;i&gt;one&lt;/i&gt;, and place in the new data set&amp;nbsp;&lt;i&gt;two&lt;/i&gt;&amp;nbsp;the original variables together with the new ones that are defined.&lt;br /&gt;
There are two data sets now.&amp;nbsp; Suppose we want to print both of them.&amp;nbsp;&amp;nbsp;Most procs, including proc print, will use the&amp;nbsp;&lt;span style=&quot;font-weight: 700;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;most recently created data set&lt;/span&gt;&lt;/span&gt;&amp;nbsp;by default.&amp;nbsp; Thus the second statement below would print only&amp;nbsp;&lt;i&gt;two&lt;/i&gt;.&amp;nbsp;&amp;nbsp;To specify another data set, use the syntax shown in the first statement below.&amp;nbsp;&amp;nbsp;Each “proc print” statement prints one data set.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;104&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS12/SAS12.h3.gif&quot; width=&quot;281&quot; /&gt;&lt;br /&gt;
&lt;b&gt;Using Data Set Options with Set Statements&lt;/b&gt;&lt;br /&gt;
Next we show how data set options can be applied to either input or output data sets when using the set statement to read another data set.&amp;nbsp; In the example below, data set&amp;nbsp;&lt;i&gt;one&lt;/i&gt;&amp;nbsp;is first created to serve as the input data set.&amp;nbsp; The data sets&amp;nbsp;&lt;i&gt;two&lt;/i&gt;&amp;nbsp;and&amp;nbsp;&lt;i&gt;three&lt;/i&gt;&amp;nbsp;will be exactly the same, but the processes by which they are produced differ.&amp;nbsp; When&amp;nbsp;&lt;i&gt;two&lt;/i&gt;&amp;nbsp;is created, all four variables from&amp;nbsp;&lt;i&gt;one&lt;/i&gt;&amp;nbsp;are read into memory, then when the data are written to&amp;nbsp;&lt;i&gt;two&lt;/i&gt;&amp;nbsp;the variables x and y are eliminated.&amp;nbsp; When&amp;nbsp;&lt;i&gt;three&lt;/i&gt;&amp;nbsp;is created, only&amp;nbsp;&lt;i&gt;sumxy&lt;/i&gt;&amp;nbsp;and&amp;nbsp;&lt;i&gt;prodxy&lt;/i&gt;&amp;nbsp;are read into memory from&amp;nbsp;&lt;i&gt;one&lt;/i&gt;, and subsequently saved to&amp;nbsp;&lt;i&gt;three&lt;/i&gt;.&amp;nbsp; If there are many variables and observations involved, the second method is preferred because it is more efficient (saves system resources).&amp;nbsp; However, you cannot drop variables from an input data set if you intend to use them in calculations!&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;262&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS07/SAS7.10.gif&quot; width=&quot;355&quot; /&gt;&lt;br /&gt;
The&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;firstobs&lt;/span&gt;&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;obs&lt;/b&gt;&lt;/span&gt;&amp;nbsp;options specify the starting and stopping observation number to read.&amp;nbsp; They do not apply to output data sets, but are used with set statements and in procs where data sets are referenced.&amp;nbsp; In the first example, a second data set is created using these options to make a subset of the original data.&amp;nbsp; Note the observation numbers in the output.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;423&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS07/SAS7.11.gif&quot; width=&quot;353&quot; /&gt;&lt;br /&gt;
In the next example, the option is given in the proc print statement.&amp;nbsp; Compare the observation numbers.&amp;nbsp; In both cases, the observation numbers correspond to the observations actually stored in the data.&amp;nbsp; They are not renumbered by proc print.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;390&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS07/SAS7.12.gif&quot; width=&quot;373&quot; /&gt;&lt;br /&gt;
Finally, we discuss the&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;rename&lt;/span&gt;&lt;/b&gt;&amp;nbsp;option.&amp;nbsp; At times it will be necessary to change the names of variables.&amp;nbsp; As with the other options, this can be done when reading or writing the data.&amp;nbsp; When used with an output data set, it renames the variables when the data set is saved, and does not affect the names used within the data step, as shown below.&amp;nbsp; Also, the rename option requires another set of parentheses for the list of variables to be renamed.&amp;nbsp; The name change is specified as &quot;&lt;i&gt;old name=new name&lt;/i&gt;.&quot;&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;350&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS07/SAS7.14.gif&quot; width=&quot;506&quot; /&gt;&lt;br /&gt;
When the rename statement is used with an input data set, the new names are in effect during the data step, as in this example:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;459&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS07/SAS7.15.gif&quot; width=&quot;375&quot; /&gt;&lt;br /&gt;
&lt;b&gt;Using Firstobs and Obs in the Infile Statement&lt;/b&gt;&lt;br /&gt;
Firstobs and obs can also be used in the infile statement when reading from an external file or cards.&amp;nbsp; Here, the syntax is different, since they are not connected with a data set, and the options are simply typed on the line following the filename or cards keyword.&amp;nbsp; There is one other difference--in this case, the numbers refer to the starting and ending line in the data, which is not always the same as the observation (e.g., observations might take up two lines each).&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;412&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS07/SAS7.13.gif&quot; width=&quot;353&quot; /&gt;&lt;br /&gt;
&lt;b&gt;Concatenating Data Sets Using the Set Statement&lt;/b&gt;&lt;br /&gt;
The set statement can also be used to combine data sets in various ways.&amp;nbsp; The first way is called&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;concatenation&lt;/span&gt;&lt;/b&gt;, and is simply combining them in order, one after the other.&amp;nbsp; The example below uses two data sets, but there can be more.&amp;nbsp; When using concatenation, all of the observations of all of the listed data sets are included in the result.&amp;nbsp; All variables from all the sets are included, with missing values assigned in cases where a variable does not occur in the original.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;381&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS08/8.01.gif&quot; width=&quot;407&quot; /&gt;&lt;br /&gt;
Suppose the data sets have different variable names.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;382&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS08/8.02.JPG&quot; width=&quot;448&quot; /&gt;&lt;br /&gt;
You could use data set options to re-align the variables in a case like this.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;389&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS08/8.03.JPG&quot; width=&quot;440&quot; /&gt;&lt;br /&gt;
&lt;b&gt;Combining Observations with the Set Statement&lt;/b&gt;&lt;br /&gt;
The second method of combining data sets is called &quot;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;one-to-one reading&lt;/span&gt;&lt;/b&gt;&quot; and may be thought of as a side-by-side version of concatenation.&amp;nbsp; The programming difference is that while in concatenation the source data sets are listed in one set statement, in one-to-one reading each source data set is given in a separate set statement.&amp;nbsp; If the same variable names occur in more than one source data set, the values of the later sets overwrite the earlier ones.&amp;nbsp; If the data sets do not have the same number of observations, the result is cut off at the length of the shortest set.&amp;nbsp; The example below shows two data sets of different lengths and the same variables.&amp;nbsp; The&amp;nbsp;&lt;i&gt;x&lt;/i&gt;&amp;nbsp;variable is changed using a rename option during input.&amp;nbsp; Thus the&amp;nbsp;&lt;i&gt;source&lt;/i&gt;&amp;nbsp;variable is overwritten with the second data set values, but because of the name change, we now have&amp;nbsp;&lt;i&gt;x&lt;/i&gt;&amp;nbsp;and&amp;nbsp;&lt;i&gt;y&lt;/i&gt;&amp;nbsp;coming from the original&amp;nbsp;&lt;i&gt;x&lt;/i&gt;&amp;nbsp;variables.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;410&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS08/8.04.gif&quot; width=&quot;462&quot; /&gt;&lt;br /&gt;
&lt;b&gt;Interleaving Data with the Set Statement&lt;/b&gt;&lt;br /&gt;
The third method is called interleaving.&amp;nbsp; This is like concatenation, except that the observations are combined so that they are sorted, instead of having one data set placed after the other.&amp;nbsp; The variable(s) on which the sort is done are called&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;by variables&lt;/span&gt;&lt;/b&gt;, and the interleave is done by adding a&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;by statement&amp;nbsp;&lt;/span&gt;&lt;/b&gt;to the concatenation program.&amp;nbsp; The by variables must be sorted before the interleave is done, so if they are not in order to begin with, we use&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;proc sort&lt;/span&gt;&lt;/b&gt;&amp;nbsp;to do the job.&amp;nbsp; Proc sort will also have a by statement, listing the by variable(s), just like the data step that does the interleave.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;475&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS08/8.05.gif&quot; width=&quot;498&quot; /&gt;&lt;br /&gt;
&lt;b&gt;Merging Data Sets&lt;/b&gt;&lt;br /&gt;
Now, if you&#39;re thinking ahead, you must realize that we should be able to take this to another level--how about putting the data side-by-side while matching up variables?&amp;nbsp; That&#39;s called a&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;merge&lt;/span&gt;&lt;/b&gt;. And that&#39;s where we&#39;re going next.&amp;nbsp; But before getting to the programming, there are some things that need to be explained.&amp;nbsp; We need to be very careful about how things match up.&amp;nbsp; For convenience, we&#39;ll visualize the data sets laid out side by side, so that we have a right and a left data set.&amp;nbsp; The simplest case occurs when there is exactly one item on the left to match exactly one item on the right.&amp;nbsp; This is called a&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;one-to-one merge&lt;/span&gt;&lt;/b&gt;.&amp;nbsp; If there is exactly one on the left to match more than one on the right, we call it a&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;one-to-many merge&lt;/span&gt;&lt;/b&gt;, and if the roles are reversed, a&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;many-to-one merge&lt;/span&gt;&lt;/b&gt;.&amp;nbsp; Finally, if there are multiple instances of variable values on both sides, it is called a&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;many-to-many merge&lt;/span&gt;&lt;/b&gt;.&amp;nbsp; The latter should usually be avoided, but an example will be provided to show what happens.&lt;br /&gt;
Our first example will be&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;one-to-one reading&lt;/span&gt;&lt;/b&gt;&amp;nbsp;again, but this time using a&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;merge statement&lt;/span&gt;&lt;/b&gt;.&amp;nbsp; The difference is that the data set continues building until the end of the longest data set is reached.&amp;nbsp; (In the following examples the variables have been given unique names to avoid needing rename options.)&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;421&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS08/8.06.gif&quot; width=&quot;287&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;139&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS08/8.07.gif&quot; width=&quot;510&quot; /&gt;&lt;br /&gt;
Next, we do a one-to-one merge.&amp;nbsp; The data sets will be matched by the&amp;nbsp;&lt;i&gt;name&lt;/i&gt;&amp;nbsp;variable, therefore this variable may be called the&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;match key&lt;/span&gt;&lt;/b&gt;.&amp;nbsp; The match key is identified using a by statement, and it must be the same in both source data sets.&amp;nbsp; Just as in interleaving, the data sets must be sorted.&amp;nbsp; To simplify the example, the data are entered in sorted order. Note that if something doesn&#39;t have a match, it is included, with missing values where the matching data should be.&amp;nbsp; Also, this is a good time to mention that SAS character variables are case sensitive, so that &quot;john&quot; and &quot;John&quot; are two different values.&amp;nbsp; If your data might have mixed case, the upcase function can be used to convert everything to upper case to ensure it matches.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;420&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS08/8.08.gif&quot; width=&quot;287&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;140&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS08/8.09.gif&quot; width=&quot;510&quot; /&gt;&lt;br /&gt;
Now consider a one-to-many merge.&amp;nbsp; We will have one instance of each name on the left, and multiple instances of some names on the right.&amp;nbsp; There is no change to the program (only the data).&amp;nbsp; The result is that one observation is produced for each observation on the &quot;many&quot; side, but if there is no match, again the relevant observations on either side are included with missing values.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;410&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS08/8.10.gif&quot; width=&quot;287&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;153&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS08/8.11.gif&quot; width=&quot;511&quot; /&gt;&lt;br /&gt;
Here is the result of a many-to-many merge.&amp;nbsp; The technical details of what happens are a bit complicated, but we can say, in a simplified way, that SAS matches lines side-to-side until one side runs out of the matching observations, then it repeats the last observation from the short side until the long side runs out of the matching value.&amp;nbsp; (If you go back to the previous examples, you can see that they are special cases of this more general result.)&amp;nbsp; There are very few situations where this behavior is desirable.&amp;nbsp; Most merging is done with one-to-one or one-to-many relationships.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;374&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS08/8.12.gif&quot; width=&quot;271&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;131&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS08/8.13.gif&quot; width=&quot;513&quot; /&gt;&lt;br /&gt;
As a final comment, note that while there is a useful purpose for having two or more set statements, there is nothing similar for merge statements.&amp;nbsp; You can put two or more merge statements in a data step, with or without a by statement, and not get an error message, but the resulting data values may be intermingled in &quot;unexpected&quot; ways.&lt;br /&gt;
&lt;br /&gt;
Exercises&lt;br /&gt;
1. Refer to the data in Exercise #1 of Lesson 6.&amp;nbsp; For each of the following, include a proc print to display the results.&amp;nbsp; Use appropriate titles.&amp;nbsp; This can all be done in one program.&lt;br /&gt;
&lt;ol type=&quot;a&quot;&gt;
&lt;li&gt;Create a data set with only the three given variables.&amp;nbsp; Name the variables x, y, and z. (This is the only time you will use cards.)&lt;/li&gt;
&lt;li&gt;Create another data set, using a set statement, that takes the SAS data set in Part a as input, renames the variables length, width, and height during reading (on the way in), and calculates the volume and cost as in Lesson 6.&lt;/li&gt;
&lt;li&gt;Do as in Part b, except this time rename the variables when the data set is written (on the way out, this does not mean in proc print).&lt;/li&gt;
&lt;li&gt;Do as in Part b, except this time use obs and firstobs to bring in only the third and fourth observations from the original data set.&lt;/li&gt;
&lt;li&gt;Using the data set created in Part b as input, create a new data set that contains only the volume and cost variables.&lt;/li&gt;
&lt;/ol&gt;
2.&amp;nbsp; Refer to Exercise #2 of Lesson 5.&lt;br /&gt;
&lt;ol type=&quot;a&quot;&gt;
&lt;li&gt;Begin with the same input statement as was used in Lesson 5, then create a new name variable of the form &quot;Lastname, Firstname&quot; and another of the form &quot;City, ST zip#&quot;.&amp;nbsp; Use an option to eliminate the original five variables used to create these new variables.&lt;/li&gt;
&lt;li&gt;Create another data set where you use obs and firstobs in the infile statement to read the second and third lines of data only.&lt;/li&gt;
&lt;/ol&gt;
3.&amp;nbsp; Download this&amp;nbsp;&lt;a href=&quot;http://galsterhome.com/stats/Tutorial/SAS12/DataL12a.txt&quot;&gt;data&lt;/a&gt;. Do not change the file or copy it into your editor.&amp;nbsp; Look at it with a text editor, such as Notepad.&amp;nbsp; There are two sections, with headings that say &quot;1.&quot; and &quot;2.&quot; (These lines are not to be considered observations).&lt;br /&gt;
&lt;ol type=&quot;a&quot;&gt;
&lt;li&gt;Write two data steps, using this one file as the source in both cases, but using firstobs and obs to control the starting and ending line so that each section is read into its own data set.&amp;nbsp; The data have a city name and state abbreviation.&amp;nbsp; Read these as two variables, &quot;City&quot; and &quot;State.&quot;&amp;nbsp; Use a length statement to make the city variable long enough not to cut any of the names short and make the state abbreviation of length 2.&amp;nbsp; Create a new variable that forms a single five-character abbreviation using the first three letters of the city and the two letters of the state abbreviation.&amp;nbsp; Create another variable that concatenates the city and state with a comma and one space immediately following the city.&amp;nbsp; It should look something like this:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Obs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; city&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; state&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shortcity&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; longcity&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bismarck&amp;nbsp;&amp;nbsp;&amp;nbsp; ND&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BisND&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bismarck, ND&lt;/li&gt;
&lt;li&gt;Concatenate the two data sets and print the result.&amp;nbsp; (Do not sort the data before this step.)&lt;/li&gt;
&lt;li&gt;Next, interleave the two data sets.&amp;nbsp; Remember they must be sorted first.&amp;nbsp; Use &quot;state&quot; as the by variable. Print the results but use a data set option&amp;nbsp;&lt;b&gt;within proc print&lt;/b&gt;&amp;nbsp;to show only the &quot;longcity&quot; variable and observation number.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Next, merge the two data sets using &quot;state&quot; as the matching variable and applying the rename option as needed (within this data step).&amp;nbsp; Use an option&amp;nbsp;&lt;b&gt;in the data statement&lt;/b&gt;&amp;nbsp;so that only the two original city variables and the state remain in the new data set.&amp;nbsp;Print the result (with no data set options used in proc print this time).&lt;/li&gt;
&lt;/ol&gt;
4.&amp;nbsp; Copy the SAS code below into the editor to start with.&amp;nbsp; Assume that these data sets represent an inventory list that is being revised at each step.&amp;nbsp; The prices change each time, but the &quot;itemno&quot; is revised between new1 and new2 only. Write a program that does the following, and print each of the data sets you create.&lt;br /&gt;
&lt;ol type=&quot;a&quot;&gt;
&lt;li&gt;Merge new2 and new3 with itemno as the match key, and show old and new prices.&lt;/li&gt;
&lt;li&gt;Merge new1 and new3 with name as the match key, including&amp;nbsp; the old and new values of &quot;itemno&quot; and price in the result..&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;data new1;
input itemno name $ price;
cards;
325 PrintCrd 211
276 KeyPad 37
842 PnclHldr 8
422 PaprShrd 132
523 Basket 29
;
data new2;
input itemno name $ price;
cards;
333 PrintCrd 399
277 KeyPad 25
802 PnclHldr 12
417 PaprShrd 122
515 Basket 17
;
data new3;
input itemno name $ price;
cards;
333 PrintCrd 386
277 KeyPad 25
802 PnclHldr 11
417 PaprShrd 135
515 Basket 15
;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/8990636644803700345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/lesson-7-data-set-options-set-and-merge.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/8990636644803700345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/8990636644803700345'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/lesson-7-data-set-options-set-and-merge.html' title='Lesson 7:  Data Set Options, Set and Merge Statements'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s72-c/SAS_TPTK_logo.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-7005285917274335479</id><published>2012-09-02T11:41:00.002+05:30</published><updated>2012-09-02T11:41:29.562+05:30</updated><title type='text'>Lesson 6:  Creating Variables</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Creating Variables with Assignment Statements&lt;/b&gt;&lt;br /&gt;
You can create variables that are not in the data that you are reading.&amp;nbsp;&amp;nbsp;In the following program,&amp;nbsp;&lt;i&gt;avgrowth&lt;/i&gt;&amp;nbsp;is calculated from the other variables in the data.&amp;nbsp;&amp;nbsp;Second,&amp;nbsp;&lt;i&gt;dummy&lt;/i&gt;&amp;nbsp;is assigned a&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;constant&lt;/span&gt;&lt;/b&gt;&amp;nbsp;value.&amp;nbsp;Since the value assigned to it is a&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;character string&lt;/span&gt;&lt;/b&gt;, indicated by the quotes around it,&amp;nbsp;&lt;i&gt;dummy&lt;/i&gt;&amp;nbsp;will be a character&amp;nbsp;&amp;nbsp;variable of length 3, because that is the length of the first value assigned to it.&amp;nbsp; Unless a length statement is used to set the length of a character variable before it is used, the length will be determined by the first value assigned to it.&amp;nbsp; Numeric constants can also be assigned, simply by putting a number on the right side of the equal sign (no quotes).&lt;br /&gt;&lt;br /&gt;&lt;img border=&quot;0&quot; height=&quot;380&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS06/6.01.gif&quot; width=&quot;543&quot; /&gt;&lt;br /&gt;
Obviously, variables are created by the input statement, but they are also created if they are specified in a length, attrib, format, or informat statement (see below).&amp;nbsp; They can also be created by array definitions (a later topic), or by&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;assignment statements&lt;/span&gt;&lt;/b&gt;, such as those in the example above.&amp;nbsp; An assignment statement is made up of a variable name, an equal sign, and an expression representing the value to be assigned to the variable.&amp;nbsp; The variable can appear in its own assigned expression, such as x=x+1, or x=log(x).&amp;nbsp; A very special form of assignment statement, called a&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;sum statement&lt;/span&gt;&lt;/b&gt;, or an&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;accumulator&lt;/span&gt;&lt;/b&gt;, is an exception to this syntax.&amp;nbsp; In the example below, p and q are accumulators.&amp;nbsp; Their values are incremented, starting from zero, by the amount specified, for each succeeding observation.&amp;nbsp; The accumulator p+1, below, is essentially the same as p=p+1, except that it is initialized to zero, which does not automatically happen if you use p=p+1. (See also the retain statement.)&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;250&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS06/6.02.gif&quot; width=&quot;551&quot; /&gt;&lt;br /&gt;
The arithmetic operations and mathematical functions used in assignment statements for numeric values are quite intuitive.&amp;nbsp; The syntax is similar to that used for formulas on a graphing calculator or spreadsheet.&amp;nbsp; The arithmetic operations are &quot;+&quot;&amp;nbsp; (add), &quot;-&quot; (subtract or negative), &quot;*&quot; (multiply), and &quot;/&quot; (divide).&amp;nbsp; Exponents are given with a double asterisk, such as &quot;3**2&quot; (three to the second power).&amp;nbsp; Parentheses are used in the usual manner for controlling order of operations.&amp;nbsp; Many functions are available, and their names can often be guessed because of their similarity to standard mathematical notation.&amp;nbsp; All functions have at least one argument enclosed in parentheses.&amp;nbsp; Some examples are sqrt(x) for square root of x (where x can be a number, variable name, or other expression that evaluates to a non-negative number), log(x) for natural log, and exp(x) for the exponential function (&quot;e to the x&quot;).&amp;nbsp; There are also some constants, such as pi, given by the function constant(pi).&amp;nbsp; For more detailed information about functions, see the SAS Documentation under &quot;Base SAS/SAS Language Reference: Dictionary/Dictionary of Language Elements/Functions and CALL Routines.&quot;&amp;nbsp; (Note:&amp;nbsp; Some of the documented functions may not work in The Learning Edition.)&amp;nbsp; Here are a few more examples:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;446&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS06/6.03.gif&quot; width=&quot;538&quot; /&gt;&lt;br /&gt;
Since dates are numbers, you can do simple things like subtract two dates to find the number of days between them, without any problem.&amp;nbsp; However, for more complicated tasks, SAS has quite a few date-related functions.&amp;nbsp; For example day(x) returns the day of the month, month(x) returns the month number for a date, and qtr(x) returns the quarter number.&amp;nbsp; If you have to do any serious computations with dates, check the SAS documentation for available tools.&amp;nbsp; Remember, SAS also has date-time values, and functions to go along with them, as well.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;354&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS06/6.04.gif&quot; width=&quot;544&quot; /&gt;&lt;br /&gt;
For character variables, there is an operation called concatenation, indicated by &quot;||&quot; (two vertical bars), that puts two character strings together.&amp;nbsp; There are many, many functions for character variables.&amp;nbsp; We will just look at a few:&amp;nbsp;&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;substr(source, position, length)&lt;/span&gt;&lt;/b&gt;&amp;nbsp;which extracts a substring,&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;trim(source)&lt;/span&gt;&lt;/b&gt;&amp;nbsp;which eliminates trailing blanks,&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;length(source)&lt;/span&gt;&lt;/b&gt;&amp;nbsp;which calculates the length of the value excluding trailing blanks, and&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;upcase(source)&lt;/span&gt;&lt;/b&gt;&amp;nbsp;which changes all the letters to upper case.&lt;br /&gt;
In the program below, a length statement has been used for the city variable, to allow up to 15 letters.&amp;nbsp; Note that this method would not work for city names that have more than one word, like &quot;New York City.&quot;&amp;nbsp; The st (state) variable has been given an informat for two characters, but a colon modifier is used so that the pointer will move on to the beginning of the zip code.&amp;nbsp; Zip codes should always be character variables, otherwise those that start with zero will be shortened.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;536&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS06/6.05.gif&quot; width=&quot;540&quot; /&gt;&lt;br /&gt;
The first assigned variable, addr1, is created by simply concatenating all three variables.&amp;nbsp; Note the (possibly undesirable) result, with the &quot;extra&quot; spaces between city and state, and the lack of spaces between state and zip code.&amp;nbsp; The spaces are there because the variable length is, in fact, 15, and the unused positions are filled with spaces.&amp;nbsp; Concatenation uses the whole variable, including spaces.&lt;br /&gt;
In&amp;nbsp;&lt;i&gt;addr2&lt;/i&gt;&amp;nbsp;we have removed the trailing spaces from city by using a&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;trim&lt;/b&gt;&lt;/span&gt;&amp;nbsp;function.&amp;nbsp; Now there are no spaces between any of the combined variables.&lt;br /&gt;
In&amp;nbsp;&lt;i&gt;addr3&lt;/i&gt;, we have included punctuation and spaces between the variables.&amp;nbsp; Notice that the concatenation operation works with constant expressions enclosed in quotes, as well as variables.&amp;nbsp; Spaces are preserved just as written between the quotes, including the one space after the comma and the two spaces in front of the zip code.&lt;br /&gt;
The&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;upcase&lt;/b&gt;&lt;/span&gt;&amp;nbsp;function is demonstrated in addr4, which converts addr3 to all uppercase characters.&amp;nbsp; Following that, the&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;substring&lt;/span&gt;&lt;/b&gt;&amp;nbsp;function is used to create a four-letter abbreviation, by extracting the first two letters of city and combining them with the state code.&amp;nbsp; Note the order of the three arguments, first the source variable, then the starting position, then the number of characters to extract.&lt;br /&gt;
The last assignment statement shows how we can combine various functions to perform a specialized task.&amp;nbsp; The idea here was to find the middle character of the city variable, defined to be the actual middle character for odd lengths and the letter immediately prior to the middle for even lengths.&amp;nbsp; The substring function is used to extract the character, but the starting position must be calculated.&amp;nbsp; The&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;length&lt;/span&gt;&lt;/b&gt;&amp;nbsp;function divided by two would be almost right, as it works fine for even lengths, but for odd lengths gives a half, like 4.5 for &quot;Brookings.&quot;&amp;nbsp; Since the middle character is the next higher whole number, we can use the ceiling function, one of several rounding functions available, this being the one that always rounds any decimal value up to the next integer.&lt;br /&gt;
&lt;b&gt;Length, informat, and attrib statements&lt;/b&gt;&lt;br /&gt;
An alternative to specifying informats in the input statement is to use an&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;informat statement&lt;/span&gt;&lt;/b&gt;.&amp;nbsp; The informat statement has the same syntax as the format statement.&amp;nbsp; It doesn&#39;t do anything that can&#39;t be done in the input statement, but it might be convenient to keep things organized, as in this example:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;120&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS06/6.06.jpg&quot; width=&quot;650&quot; /&gt;&lt;br /&gt;
Numeric variables have a default length of 8 bytes in SAS.&amp;nbsp; As we have seen, there is also a default length of 8 for character variables, if they are read using a $ informat, or if an informat is used, the length depends on&amp;nbsp;&lt;i&gt;n&lt;/i&gt;&amp;nbsp;in &quot;&lt;span style=&quot;font-family: Courier;&quot;&gt;$&lt;i&gt;n&lt;/i&gt;.&lt;/span&gt;&quot;.&amp;nbsp; In a later section, we will see that if character variables are created using data step programming statements, they get their lengths from the first value assigned to them.&amp;nbsp; The&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;length statement&lt;/span&gt;&lt;/b&gt;&amp;nbsp;can be used to override the default lengths for both character and numeric variables.&lt;br /&gt;
It&#39;s not often we want to change the length of a numeric variable.&amp;nbsp; Sometimes space can be saved when the values are integers.&amp;nbsp; The allowed lengths are from 3 to 8 for PC SAS.&amp;nbsp; A length of 3 will accommodate accurate integer values from -8192 to 8192.&amp;nbsp; A length of 4 works to slightly over 2 million.&amp;nbsp; It is not recommended to use shortened numeric values when fractions (decimals) are involved.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;405&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS06/6.07.jpg&quot; width=&quot;542&quot; /&gt;&lt;br /&gt;
In the above example, you can see that the length statement has syntax similar to the format or informat statements.&amp;nbsp; However, the &quot;dot&quot; is not required.&amp;nbsp; Here it has been left out for the numeric length and included for the character length, just for an example.&amp;nbsp; The dollar sign, however, is required for character variables.&amp;nbsp; The length statement must occur before the first use of the variable in the program, or it will not have any effect.&lt;br /&gt;
Another way to use the length statement is shown below.&amp;nbsp; This example sets the default numeric length to 3.&amp;nbsp; Unless you specify other lengths, all numeric variables in this data set will have length 3.&amp;nbsp; (This only works for numeric variables.)&amp;nbsp; The character variables will have length 8.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;120&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS06/6.08.jpg&quot; width=&quot;541&quot; /&gt;&lt;br /&gt;
Another way to do this is with the&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;attrib statement&lt;/span&gt;&lt;/b&gt;, which is more complicated and allows you to set the lengths, formats, informats, and labels all in one command:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;416&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS06/6.09.jpg&quot; width=&quot;540&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
Exercises:&lt;br /&gt;
For each of the following exercises, copy and paste the data given in the problem into the SAS editor.&amp;nbsp; Write a data step to read the data and create the new variables described, then print the results using proc print, using appropriate titles.&lt;br /&gt;
1.&amp;nbsp; These numbers represent dimensions of cardboard boxes, length, width, and height, in&amp;nbsp;&lt;b&gt;inches&lt;/b&gt;.&lt;br /&gt;
&lt;ol type=&quot;a&quot;&gt;
&lt;li&gt;Calculate the volume of each box in cubic feet.&lt;/li&gt;
&lt;li&gt;Calculate the amount of cardboard needed to make each box in square feet, assuming that the top and bottom flaps meet in the middle (this results in a double layer of cardboard for both top and bottom).&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Suppose the cost of cardboard is $.05 per square foot, and there is a fixed cost of $.25 for manufacturing each box regardless of size.&amp;nbsp; Calculate the cost of manufacturing each box.&lt;/li&gt;
&lt;li&gt;Calculate the cost per cubic foot of volume.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;32 18 12
16 15 24
48 12 32
15 30 45
20 30 36
&lt;/pre&gt;
2.&amp;nbsp; This problem will provide a little practice in writing complicated formulas in SAS, paying attention to order of operations.&amp;nbsp; Use the data below, with variables a, b, and c, and apply the following formulas to create two new variables called root and trunk.&amp;nbsp; The first observation&#39;s results are -1 and 2.094, respectively.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;46&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS07/SAS7.16.gif&quot; width=&quot;102&quot; /&gt;&amp;nbsp; ,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img border=&quot;0&quot; height=&quot;73&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS07/SAS7.17.gif&quot; width=&quot;108&quot; /&gt;&lt;br /&gt;
&lt;pre&gt;1 6 5
4 -20 2
12 22 -11
3 -15 -9
&lt;/pre&gt;
3.&amp;nbsp; Read the following data into three variables, making sure to get complete names.&amp;nbsp; Use the character functions and operators to extract initials from the following names so that they look like &quot;J.F.K.&quot;&amp;nbsp; Then create an abbreviation for each name that looks like &quot;J-n F-d K-y&quot;.&lt;br /&gt;
&lt;pre&gt;John Fitzgerald Kennedy
Martha Helena Goetz
Frederich Anthony Sailer
Albert Blake Codwell&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/7005285917274335479/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/lesson-6-creating-variables.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/7005285917274335479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/7005285917274335479'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/lesson-6-creating-variables.html' title='Lesson 6:  Creating Variables'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s72-c/SAS_TPTK_logo.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-7094806863383993003</id><published>2012-09-02T11:40:00.003+05:30</published><updated>2012-09-02T11:40:30.328+05:30</updated><title type='text'>Lesson 5:  Input Styles</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It&#39;s time to dig a little deeper into the technical details of data reading.&amp;nbsp; Before we do that, it is important to make clear what we mean by &quot;reading&quot; and &quot;writing&quot; in a data step.&amp;nbsp; &quot;Reading&quot; is the process whereby SAS interprets raw data from a file or an instream cards section of the program, or when it accesses an existing data set.&amp;nbsp; Thus, &quot;reading&#39; means SAS is bringing data values into computer memory to process in the data step.&amp;nbsp; &quot;Writing&quot; is the process of saving the finished data to a SAS data set file on a hard drive (or other computer storage device).&amp;nbsp; It is NOT the same as &quot;printing.&quot; which is a term by which we usually mean &quot;use proc print to display text in the Output Window.&quot;&lt;br /&gt;
Imagine that you are a computer and are instructed to read a file.&amp;nbsp; What do you actually do?&lt;br /&gt;
Well, as a human, how do you read a book?&amp;nbsp; First you have to open it.&amp;nbsp; You find the starting place, and you begin reading, which at the most fundamental level means you read a character, interpret it, and move on to the next one, and repeat.&amp;nbsp; Upon reaching the end of a word, you interpret the word, and move on to the next one.&amp;nbsp;&amp;nbsp; Upon reaching the end of a line, you move down a line and go back to the left and read the first character, and so on, until you reach the end of the book, at which point you close it and stop.&amp;nbsp; Well, something like that, anyway.&amp;nbsp; For us, so much happens automatically, we don&#39;t have to think about it.&amp;nbsp; But, a computer doesn&#39;t think at all.&amp;nbsp; It merely follows a sequence of instructions, and this sequence, in some ways, is similar to processes we humans follow when reading a book.&lt;br /&gt;
When SAS opens a file to read it, it creates two&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;pointers&lt;/span&gt;&lt;/b&gt;, which are nothing more than numbers for keeping track of position in the file.&amp;nbsp; One pointer is a position in a line of text (column), the other is the line number in the file.&amp;nbsp; (We are assuming a standard text file here.&amp;nbsp; SAS can also read binary files, but that is another subject.)&amp;nbsp; The pointers are initially at column 1, line 1.&amp;nbsp; As SAS reads data, the pointer moves along the line (not literally, of course, the number just changes).&amp;nbsp; SAS needs to know when to begin reading a value and when to stop. What is obvious to us is not necessarily obvious to a computer.&amp;nbsp; Consider the following line:&lt;br /&gt;
12 33 42 51 24&lt;br /&gt;
Do you see five numbers?&amp;nbsp; How about this:&lt;br /&gt;
1233425124&lt;br /&gt;
If I told you this was a string of five two-digit numbers, you would know immediately how to interpret it.&amp;nbsp; We are now going to consider what must be done to tell SAS how to interpret lines of data in ways somewhat analogous to how a person would interpret them.&lt;br /&gt;
SAS has four&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;input styles&lt;/span&gt;&lt;/b&gt;.&amp;nbsp; It is easiest to learn about them one at a time, but they can actually be used together (&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;mixed input&lt;/span&gt;&lt;/b&gt;) on the same file in&amp;nbsp;&lt;i&gt;almost&lt;/i&gt;&amp;nbsp;any order.&amp;nbsp; The input styles are:&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;list&lt;/span&gt;&lt;/b&gt;,&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;column&lt;/span&gt;&lt;/b&gt;,&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;formatted&lt;/span&gt;&lt;/b&gt;, and&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;named&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;input&lt;/span&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;List input&amp;nbsp;&lt;/span&gt;&lt;/b&gt;is perhaps the most straightforward.&amp;nbsp; The data values are simply given in a &quot;list,&quot; one after the other, with a delimiter between them.&amp;nbsp; The delimiter is often just a space (that&#39;s the default), but may be a comma, tab, or other character.&amp;nbsp; List input, in the simplest case, can be recognized if all you see in the input statement is variable names and dollar signs following the character variables.&amp;nbsp; Typically, the data will not be aligned in columns.&lt;br /&gt;
To make our example easier to follow, the data is shown in a &quot;cards&quot; section, but we will discuss it as though it were really an external file.&amp;nbsp; Some differences involved in actually using an external file will be dealt with later.&amp;nbsp; Notice that the data values are separated by a single space and are not aligned in columns.&amp;nbsp; The input statement contains only variable names and one dollar sign.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;289&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS05/SAS4d.5.jpg&quot; width=&quot;329&quot; /&gt;&lt;br /&gt;
When SAS processes the input statement, it creates, in memory, an &quot;input vector,&quot; which is temporary storage for all the variables in one observation.&amp;nbsp; At this point, the attributes of the variables (length, character vs. numeric) are fixed.&amp;nbsp; As the data step goes through its commands, it fills up the fields of the input vector, and when it gets to the end, it outputs one observation to the data set.&amp;nbsp; If there is more to do, it goes back and starts over, first clearing the input vector, then filling it up again.&amp;nbsp; One pass like this is known as a&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;data step iteration&lt;/b&gt;&lt;/span&gt;.&lt;br /&gt;
The default length for character variables is eight characters, so in our example, that is the length of the &quot;name&quot; variable.&amp;nbsp; Age and height are numeric variables, also taking up eight bytes of memory, but that has no bearing on the number of characters to be read.&amp;nbsp; As reading begins, the pointers are set to line 1, column 1.&amp;nbsp; SAS is going to read up to eight characters into the variable &quot;name.&quot;&amp;nbsp; However, in the list input style, if first checks to see if the current character is a space (or other blank character).&amp;nbsp; If so, it advances to the next, and keeps going until it comes to a non-blank character.&amp;nbsp; Then it starts reading characters into the input vector.&amp;nbsp; When it comes to another blank, it stops.&amp;nbsp; If the data value has more than eight characters, SAS will read the first eight and save them, but will then continue advancing the pointer until a space is encountered, then stop. (Longer character variables can be specified using the &quot;colon modifier,&quot; &quot;:$&lt;i&gt;w&lt;/i&gt;.&quot; as has been shown in a previous section.&amp;nbsp; The colon causes SAS to read in list style even when there is an informat present.&amp;nbsp; There is also an &quot;ampersand modifier&quot; which allows use of a character informat and reads imbedded spaces.&amp;nbsp; Multiple spaces then signal the end of the field.)&lt;br /&gt;
The second variable, &quot;age,&quot; is a number.&amp;nbsp; With list input, SAS can only read numbers in &quot;standard&quot; format, which essentially means there can be only numerals, decimals, and minus signs present.&amp;nbsp; SAS again advances the pointer to the first non-blank character and begins reading the number until it encounters a space.&amp;nbsp; The number of columns read is immaterial this time, as SAS will simply store the number with as much precision as it can, regardless of how many&amp;nbsp; numerals were given.&amp;nbsp; When it reaches a space, SAS saves the number to the input vector and stops.&amp;nbsp; The third variable, &quot;height,&quot; is read the same way, except that we are now at the end of a line.&amp;nbsp; Upon reaching the end of the line, SAS saves the value, moves the column pointer back to 1, and advances the line pointer to the next number.&amp;nbsp; As it has come to the end of the input statement as well, it considers the observation complete and writes the contents of the input vector to the output data set.&amp;nbsp; It then clears the input vector and starts over, repeating until the end of&amp;nbsp; the file is reached.&lt;br /&gt;
Missing values for character variables require special care with list input, since spaces are interpreted as delimiters and cannot then represent missing values.&amp;nbsp; Missing values may have to be coded using a word or symbol (e.g., &quot;missing&quot;).&amp;nbsp; Options that change the delimiter (discussed later) can also solve this problem.&amp;nbsp; Numeric missing values are represented by a decimal point (period).&amp;nbsp; If values are missing at the end of a line (without a placeholder of some kind), the infile option&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;missover&lt;/span&gt;&lt;/b&gt;&amp;nbsp;can be used to set the remaining variables to missing and go on to the next line.&amp;nbsp; If this is not done, SAS will try to read the variables from the next line.&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;Column input&lt;/span&gt;&lt;/b&gt;&amp;nbsp;requires the data to be arranged in aligned columns.&amp;nbsp; The key element of column input is that you give a range of columns after each variable name, or after the dollar sign of a character variable, in the form of&amp;nbsp;&lt;i&gt;start-end&lt;/i&gt;.&amp;nbsp; Informats cannot be used in the input statement with column input. (They can be specified in a separate informat statement, introduced in the next lesson.) &amp;nbsp; There is no need to worry about the column pointer in this case, as SAS changes it according to the ranges specified.&amp;nbsp; The ranges need not be in order.&amp;nbsp; They can even overlap or be re-read.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;468&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS05/SAS4d.7.jpg&quot; width=&quot;429&quot; /&gt;&lt;br /&gt;
The next example illustrates some of the advantages of column input.&amp;nbsp; Notice that the character variable will read whatever is in the associated columns and is automatically set to the length specified by the range of columns.&amp;nbsp; Even spaces and special characters are correctly read and stored.&amp;nbsp; Missing numeric values need not be coded with a period, as spaces will be correctly interpreted as missing.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;468&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS05/SAS4d.8.jpg&quot; width=&quot;429&quot; /&gt;&lt;br /&gt;
One of the best features of column input is that no delimiters are required.&amp;nbsp; Many mainframe programs produce this kind of file, which has no extra spaces or delimiters.&amp;nbsp; This can greatly reduce the size of a file.&amp;nbsp; As long as the column positions are known, there is no difficulty with reading this data in SAS.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;468&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS05/SAS4d.9.jpg&quot; width=&quot;429&quot; /&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;Formatted input&lt;/span&gt;&lt;/b&gt;&amp;nbsp;relies on informats and pointer controls to determine where and what to read into each variable.&amp;nbsp; In the example below, the @&lt;i&gt;n&lt;/i&gt;&amp;nbsp;syntax gives the starting column for each variable.&amp;nbsp; It repositions the column pointer to that column.&amp;nbsp; The &quot;name&quot; variable has a default length of eight.&amp;nbsp; The numeric variables are read until a space is encountered.&amp;nbsp; It is important to note that the syntax here is the @&lt;i&gt;n&lt;/i&gt;&amp;nbsp;comes in front of the variable name, and the informat comes in its usual position after the variable name.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;285&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS05/SAS4d.6.jpg&quot; width=&quot;361&quot; /&gt;&lt;br /&gt;
Variables need not be in left-to-right order.&amp;nbsp; Informats may be used as needed.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;285&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS05/SAS4d.10.jpg&quot; width=&quot;427&quot; /&gt;&lt;br /&gt;
Even though I have shown the @&lt;i&gt;n&lt;/i&gt;&amp;nbsp;for each variable here, it is not really necessary in all cases.&amp;nbsp; The initial &quot;@1&quot; is not required, as the pointer starts out in column 1.&amp;nbsp; With formatted input, the line pointer will end up at the next character past the field that was just read.&amp;nbsp; IF this is the start of the next variable, you are ready to go and do not need to reposition the pointer.&amp;nbsp; The syntax &quot;+&lt;i&gt;n&lt;/i&gt;&quot; may be used to advance the pointer a specified number of columns.&amp;nbsp; Just as with column input, delimiters are not necessary when using formatted input.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;468&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS05/SAS4d.11.jpg&quot; width=&quot;429&quot; /&gt;&lt;br /&gt;
Because formatted input and column input cause SAS to read a specified number of columns, a problem occurs if the end of the line varies, as in the example of the dates given below.&amp;nbsp; When the data are instream, SAS does not have a problem.&amp;nbsp; But if the file is external, a line that is too short will cause an error.&amp;nbsp; The&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;truncover&lt;/span&gt;&lt;/b&gt;&amp;nbsp;option in the infile statement will cause SAS to treat short lines as if there were spaces in the file to fill out the remainder of the field.&amp;nbsp; If there is no data at all for the field, the observation will be set to missing.&amp;nbsp; The syntax is demonstrated here with instream data, but is only necessary for external files.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;468&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS05/SAS4d.12.jpg&quot; width=&quot;492&quot; /&gt;&lt;br /&gt;
It is often helpful with formatted input, if there are many variables, to line them up vertically in the input statement, with the @&#39;s all in front and the informats after.&amp;nbsp; I have not shown an example, but with a large number of variables, this makes it much easier to prevent and correct mistakes.&lt;br /&gt;
The log below is the result of trying to read this same data from an external file without the truncover option.&amp;nbsp; Observe that SAS is looking for the &quot;bday&quot; variable at the beginning of line 2, and since what is actually there is a name variable, it declares the data to be invalid.&amp;nbsp; The reason for this is that the &quot;bday&quot; given in line 1 is only 7 characters in length.&amp;nbsp; Since there are not enough characters, SAS goes to the next line to look for the variable.&amp;nbsp; After failing to read &quot;bday,&quot; the end of the input statement is reached, so SAS tries to move the next line to start a new input cycle, but finding the end of the file, it quits and writes only one observation to the data set.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;481&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS05/SAS4d.13.jpg&quot; width=&quot;540&quot; /&gt;&lt;br /&gt;
Including the truncover option in the infile statement fixes this problem.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;393&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS05/SAS4d.14.jpg&quot; width=&quot;545&quot; /&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;Named input&lt;/span&gt;&lt;/b&gt;&amp;nbsp;is used when each variable is identified in the data with a variable name and the equals sign.&amp;nbsp; This input style is not very common.&amp;nbsp; While named input can be mixed with the other styles, it must be&amp;nbsp;&lt;i&gt;last&lt;/i&gt;&amp;nbsp;on the line.&amp;nbsp; You cannot change back to another style.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;430&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS05/SAS4d.15.jpg&quot; width=&quot;405&quot; /&gt;&lt;br /&gt;
However, the idea demonstrated here is very useful.&amp;nbsp; In some data sets, it is difficult to identify where the variables are in the line.&amp;nbsp; If they are &quot;signaled&quot; by some identifiable text, we can use that text to determine the position of the pointer and use formatted input.&amp;nbsp; In the example below, we have given a character string in quotes with the @ sign, where we had the column number in previous examples.&amp;nbsp; SAS scans from the current column until it matches the text in quotes after the @ sign.&amp;nbsp; Note that a trailing space was included in the quotes in this example.&amp;nbsp; An alternative would be to leave out the space and increase the field width to 3.&amp;nbsp; In any case, you want to make sure the pointer ends up in the right place, which will be right after the text in quotes, and the field width matches the location of the value to be read.&amp;nbsp; In cases like this, a lot of effort is required to determine what consistent properties of the data source can be reliably used.&amp;nbsp; Careful study of the file and testing of various scenarios is required, or the result may be misread data, quite possibly with no warning of the errors.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;408&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS05/SAS4d.16.jpg&quot; width=&quot;466&quot; /&gt;&lt;br /&gt;
If the variable values are not in a consistent order in the data, we can deal with that too.&amp;nbsp; By using &quot;@1&quot; to reset the pointer back to the beginning of the line, we can make sure nothing is missed:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;408&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS05/SAS4d.17.jpg&quot; width=&quot;466&quot; /&gt;&lt;br /&gt;
To finish this off, here is an example of mixed input styles.&amp;nbsp; All four styles, list, column, formatted, and named, are demonstrated in one input statement.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;408&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS05/SAS4d.18.jpg&quot; width=&quot;466&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
Exercises:&lt;br /&gt;
For each problem below, write a SAS program that creates a data set using instream data.&amp;nbsp;&amp;nbsp;Copy and paste the given data segments into the SAS editor.&amp;nbsp;This is important in order to keep the data in the same format as presented.&amp;nbsp; DO NOT adjust the data, such as by adding spaces or aligning columns.&amp;nbsp; Include a proc print step in the program, and turn in the editor, output, and log files.&amp;nbsp;&amp;nbsp; Use appropriate titles and formats, if necessary, in your output.&lt;br /&gt;
1.&amp;nbsp; The variables are Name, Age, Height, Sex, and JoinDate.&amp;nbsp; Assume that no values will be longer than those included here, and use the shortest possible length for the character variables.&amp;nbsp; Use list input (with colon modifiers where needed).&lt;br /&gt;
&lt;pre&gt;John 21 70 M 2/14/97
Jo 18 62 F 3/27/99
Mark 32 68 M 6/22/98
Linda 25 65 F 12/14/97
Carey 27 59 F 8/20/98
&lt;/pre&gt;
2.&amp;nbsp; The variables and the columns they are found in are LastName (1-15), FirstName (16-30), Address (31-55), City (56-65), State (66-67), and Zip (68-72).&amp;nbsp; Assume that character variables may fill the entire field width.&amp;nbsp; Use column input.&lt;br /&gt;
&lt;pre&gt;Johnson        Michael        121 1st St S             Brookings SD57006
Big Hammer     Beatrice       45031 271st Ave S        Moorhead  MN56560
Helms-Marquart Charlotte      302 N Mason-Dixon Ave    Somewhere DC01221
Cutler         George         Rural Route 2            Zap       ND58563
&lt;/pre&gt;
3.&amp;nbsp; In this problem, the same variables are used as in the previous problem, but additional variables are included, namely the Social Security Number, Ownership Status, and Move-in Date.&amp;nbsp; You can see where these new variables are added.&amp;nbsp; The field widths of the variables that were in the previous problem are unchanged.&amp;nbsp; Use formatted input to read this data, but change the order of&amp;nbsp;&lt;u&gt;reading&lt;/u&gt;&amp;nbsp;to First Name, Last Name, Social Security Number, Ownership Status, Move-in Date, Address, City, State, and Zip. Use at least one example of the &quot;+&lt;i&gt;n&lt;/i&gt;&quot; syntax to move the pointer.&lt;br /&gt;
&lt;pre&gt;503118596Johnson        Michael        Own 121 1st St S             01051974Brookings SD57006
471559684Big Hammer     Beatrice       Rent45031 271st Ave S        10221987Moorhead  MN56560
362995874Helms-Marquart Charlotte      Own 302 N Mason-Dixon Ave    07091991Somewhere DC01221
474843859Cutler         George         RentRural Route 2            12161996Zap       ND58563&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/7094806863383993003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/lesson-5-input-styles.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/7094806863383993003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/7094806863383993003'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/lesson-5-input-styles.html' title='Lesson 5:  Input Styles'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s72-c/SAS_TPTK_logo.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-8850194067944283363</id><published>2012-09-02T11:39:00.001+05:30</published><updated>2013-12-12T08:42:13.845+05:30</updated><title type='text'>Lesson 4:  Numeric Formats and Informats</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SAS stores all data with only two variable types, character and numeric.&amp;nbsp; We have seen that character variables can have different lengths.&amp;nbsp; In contrast, numeric variables (including integers and dates) are almost always stored in 8-byte floating-point form.&amp;nbsp; These numbers have a precision of about 16 significant digits.&amp;nbsp; Some other languages refer to this as a &quot;real&quot; data type (which is not mathematically correct, of course).&amp;nbsp; Therefore, we do not have to be concerned about how numbers will be&amp;nbsp;&lt;i&gt;stored&lt;/i&gt;.&amp;nbsp; We do, however, have to think about how to&amp;nbsp;&lt;i&gt;read&lt;/i&gt;&amp;nbsp;and&amp;nbsp;&lt;i&gt;write&lt;/i&gt;&amp;nbsp;them.&lt;br /&gt;
Let&#39;s begin with a simple example.&amp;nbsp; Here we see a data set with three numbers.&amp;nbsp; There are no complications in reading these numbers; the variable x in the input statement is a numeric variable by default (no informat).&amp;nbsp; Observe that in the output, the first two observations were written in the same form they appeared in the data, but the third was not.&amp;nbsp; Because it is such a large number, SAS defaulted to printing this number in scientific notation.&amp;nbsp; The &quot;E18&quot; is interpreted as &quot;times 10 to the 18th power.&quot;&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;502&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS04/SAS4.01.jpg&quot; width=&quot;427&quot; /&gt;&lt;br /&gt;
The appearance of observation 3 in the output can be changed by adding a&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;format statement&amp;nbsp;&lt;/b&gt;&lt;/span&gt;to proc print, as shown below.&amp;nbsp; The actual&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;format&lt;/span&gt;&lt;/b&gt;&amp;nbsp;code is &quot;&lt;span style=&quot;font-family: Courier;&quot;&gt;19.&lt;/span&gt;&quot;.&amp;nbsp; The period or decimal point is part of the code and is standard syntax for all formats and informats.&amp;nbsp; Character formats and informats start with &quot;$&quot;.&amp;nbsp; In most formats and informats there is a number right before the period that indicates the field width.&amp;nbsp; For numeric variables only, a number after the period indicates the width of the decimal portion of the number.&lt;br /&gt;
Notice that 19 digits are now displayed, however, the last two are not the same as the original data.&amp;nbsp; There has been some rounding error.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;397&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS04/SAS4.02.jpg&quot; width=&quot;421&quot; /&gt;&lt;br /&gt;
Commas can be included in the output.&amp;nbsp; Note that the field width had to be increased to accommodate the commas.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;390&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS04/SAS4.03.jpg&quot; width=&quot;425&quot; /&gt;&lt;br /&gt;
Or perhaps you want dollars:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;390&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS04/SAS4.04.jpg&quot; width=&quot;425&quot; /&gt;&lt;br /&gt;
Let&#39;s turn to reading numbers in various formats.&amp;nbsp; First, we should note that we cannot read numbers that are not in &quot;standard format&quot; without an informat, a code that tells SAS how to interpret the number it is reading.&amp;nbsp; See what happens in this example:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;655&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS04/SAS4.05.jpg&quot; width=&quot;425&quot; /&gt;&lt;br /&gt;
The comma&lt;i&gt;w&lt;/i&gt;. (dollar&lt;i&gt;w&lt;/i&gt;. is the same) informat reads numbers with commas, as well as dollar signs and some other imbedded symbols.&amp;nbsp; The&amp;nbsp;&lt;i&gt;w&lt;/i&gt;&amp;nbsp;stands for the field width, but be sure to count the commas (and dollar signs) when determining the number of columns needed. Also, make use of the colon modifier just as with character informats, if the field widths vary.&amp;nbsp; (If you are working with other currencies or European style numbers, check the documentation for alternative informats.)&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;510&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS04/SAS4.06.jpg&quot; width=&quot;427&quot; /&gt;&lt;br /&gt;
Handling decimal places correctly can sometimes be tricky.&amp;nbsp; Here we see a basic example with no informat.&amp;nbsp; In addition, no format has been specified in proc print, so SAS chooses a format that it &quot;thinks&quot; is &quot;best.&quot;&amp;nbsp; Note that the third observation is rounded, but this is only because of the printing format that was used, and does not mean the number is rounded off in the data set.&amp;nbsp; If you add a format statement with a 9.4 format to the proc print step, all the original digits will be displayed.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;510&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS04/SAS4.07.jpg&quot; width=&quot;427&quot; /&gt;&lt;br /&gt;
Here is an example that is incorrect.&amp;nbsp; Numeric formats and informats can specify a number of decimal places by putting a number after the period.&amp;nbsp; The informat below, 4.2, is saying that SAS should read a field of width 4 with two decimal places.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;510&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS04/SAS4.08.jpg&quot; width=&quot;427&quot; /&gt;&lt;br /&gt;
One problem is that the decimal is part of the field and needs to be counted, which caused the second and third observations to be cut short.&amp;nbsp; We should have 5 instead of 4 for the field width..&amp;nbsp; Secondly, when a width for the decimal portion of the number is specified in an informat, it means that those decimal places are to be&amp;nbsp;&lt;i&gt;assumed&lt;/i&gt;&amp;nbsp;whenever no decimal point appears in the number.&amp;nbsp; It does not over-ride an existing decimal point.&amp;nbsp; The first observation is thus interpreted as 11.22, that is, assuming that the last two digits should be in the decimal portion.&amp;nbsp; This may or may not be correct, so great care must be taken when using this method.&amp;nbsp; Normally, it would only be used when the data is known to be recorded with an implied decimal.&amp;nbsp; Usually such data are not mixed (with and without decimals).&amp;nbsp; The most common situation in which mixing might occur is when a variable is a percent or proportion, and has been recorded inconsistently, using both notations.&amp;nbsp; In that case, you might want 22 and .22 to mean the same thing.&amp;nbsp; A 3.2 format would accomplish the correct result.&lt;br /&gt;
Here the field width is corrected, the decimal is left off of the informat, and a format is included in proc print to display all the decimals.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;510&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS04/SAS4.09.jpg&quot; width=&quot;427&quot; /&gt;&lt;br /&gt;
Formats can be permanently stored with the data set.&amp;nbsp; If this is done, the formats are then available to any proc that can use them, without writing another format statement.&amp;nbsp; The program shown below uses the &quot;5.&quot; informat, but also stores the &quot;9.4&quot; format in the data set.&amp;nbsp; There is no need for another format statement in proc print.&amp;nbsp; However, if you want to use a format other than the one stored with the data, you can still specify it in proc print (perhaps &quot;&lt;span style=&quot;font-family: Courier;&quot;&gt;format x 7.2;&lt;/span&gt;&quot;).&amp;nbsp; It should also be mentioned here that SAS syntax allows specifying a format for several variables at once.&amp;nbsp; For example, &quot;&lt;span style=&quot;font-family: Courier;&quot;&gt;format x y z 7.2;&lt;/span&gt;&quot; would apply the 7.2 format to all three variables, x, y, and z.&amp;nbsp; Or, you can use &quot;&lt;span style=&quot;font-family: Courier;&quot;&gt;format x 7.2 y z 5.;&lt;/span&gt;&quot; which will apply the 7.2 format to x and the 5. format to y and z.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;510&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS04/SAS4.10.jpg&quot; width=&quot;427&quot; /&gt;&lt;br /&gt;
While this covers the most frequently needed informats for numbers, there are many other special cases.&amp;nbsp; Check the SAS documentation (under Base SAS, Language Reference: Dictionary) for other formats and informats.&lt;br /&gt;
&lt;b&gt;Date Formats and Informats&lt;/b&gt;&lt;br /&gt;
Since SAS has only two data types, you may wonder what we do with dates.&amp;nbsp; While it is possible to store dates in character form, doing so would make calculations with dates very difficult.&amp;nbsp; Dates are stored as numbers, precisely, the number of days since (or before) January 1, 1960, which is &quot;day zero.&quot;&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;465&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS04/SAS4.11.jpg&quot; width=&quot;322&quot; /&gt;&lt;br /&gt;
You cannot read a date without an informat, except perhaps in the rare event that it is already coded as the number of days since 1/1/1960.&amp;nbsp; Dates can be written in many ways, and SAS can read almost any of them, with the right instructions.&amp;nbsp; In the example above, the dates are given in the most common American format, month/day/year.&amp;nbsp; The informat uses the codes mm for month, dd for day, and yy for year.&amp;nbsp; In some other countries, dates are written in the form day/month/year, so in SAS we simply switch the order accordingly, to &quot;ddmmyy&lt;i&gt;w&lt;/i&gt;.&amp;nbsp; Once again,&amp;nbsp;&lt;i&gt;w&lt;/i&gt;&amp;nbsp;stands for the width of the field that is being read, including the delimiters.&amp;nbsp; SAS does not require a specific delimiter when interpreting the date, so it does not matter if it says 1/1/1960 or 1-1-1960 or 1.1.1960.&amp;nbsp; The width is usually 10 to accommodate two digits for month, two for day, and four for year, plus two delimiters.&amp;nbsp; However, it could be 8 if only two year digits are used, and it could be 6 or 8 if no delimiters are used (010160 or 01011960).&amp;nbsp; SAS will interpret these variations correctly as long as they are not ambiguous (1160 for January 1, 1960 would not work), as in this example:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;465&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS04/SAS4.12.jpg&quot; width=&quot;322&quot; /&gt;&lt;br /&gt;
Of course, we don&#39;t want our printout to give dates like &quot;0&quot; or &quot;16604,&quot; since they are not very meaningful to human readers!&amp;nbsp; Therefore, we should include a nice format to make it readable.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;372&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS04/SAS4.13.jpg&quot; width=&quot;320&quot; /&gt;&lt;br /&gt;
There are many formats to choose from.&amp;nbsp; See the SAS documentation for more.&amp;nbsp; Here are some more examples.&amp;nbsp; In the program below, the dates appear in the data in three different formats.&amp;nbsp; The first one is like those discussed above, the second is what SAS considers a &quot;standard&quot; date, and the third is a Julian date (used in many businesses--it&#39;s the year followed by the number of the day in the year).&amp;nbsp; Three proc print steps follow, to demonstrate the dates with no format, and with six different formats.&amp;nbsp; As with character and numeric formats, date formats can also be stored with the data set.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;772&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS04/SAS4.14.jpg&quot; width=&quot;561&quot; /&gt;&lt;br /&gt;
Note that SAS also has informats and formats for time values and date-time combination values.&amp;nbsp; If you have need of these, or want to explore the many other possibilities, check out the SAS documentation.&lt;br /&gt;
&lt;b&gt;Interpreting Two-digit Years&lt;/b&gt;&lt;br /&gt;
In the years leading up to 2000, the government and businesses became very concerned about the &quot;Y2K&quot; problem.&amp;nbsp; Many programs stored years using two digits, because most business software did not need to deal with dates outside of the twentieth century.&amp;nbsp; In 2000, this all changed.&amp;nbsp; SAS never had a &quot;Y2K&quot; problem for storing dates, since a date is just the number of days before or after January 1, 1960.&amp;nbsp; However, there can still be a problem when reading dates with two-digit years from a file or instream data.&amp;nbsp; SAS interprets two-digit years as belonging in a specific 100-year interval.&amp;nbsp; The first year of this interval is called the Year Cut Off, and the SAS system option &quot;YearCutOff=&lt;i&gt;n&lt;/i&gt;&quot; is used to set it in an options statement.&amp;nbsp; The default value of YearCutOff is set by the administrator when SAS is installed, typically 1920.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Exercises&lt;br /&gt;
1.&amp;nbsp; Copy the raw data below into a SAS program.&amp;nbsp; a) Write a data step to read these data into three variables: Invoice, Amount, and Quantity.&amp;nbsp; Using proc print, display the data so that all the Amount values are formatted like the Amount value in the first observation of the raw data.&amp;nbsp; b) Then, revise the data step so that a format for Amount is stored with the data set, and show the results in proc print, without using any format statement in proc print.&amp;nbsp; Use appropriate titles that identify which part of the exercise the output comes from.&lt;br /&gt;
&lt;pre&gt;12244 $1,499.99 144
32189 $20,000 1
92314 49.28 3&lt;/pre&gt;
2.&amp;nbsp; Copy the data below into a SAS program.&amp;nbsp; Write a data step to read them into a SAS data set.&amp;nbsp; The variables are capitol, state, capitol population, and state population.&amp;nbsp; Store labels with the data set.&amp;nbsp; Print the data with proc print, displaying labels, using appropriate formats and a title.&lt;br /&gt;
&lt;pre&gt;Bismarck ND 56,344 633,837
Pierre SD 13,939 764,309
Helena MT 26,718 917,621
Madison WI 218,432 5,472,299&lt;/pre&gt;
3.&amp;nbsp; Download this&amp;nbsp;&lt;a href=&quot;http://galsterhome.com/stats/Tutorial/MiscDocs/DeadPresidents.txt&quot;&gt;file&lt;/a&gt;.&amp;nbsp; The data contain the names of some of the past presidents of the United States together with their birth and death dates.&amp;nbsp; The data are aligned in columns, as shown in the example below (the longest name).&amp;nbsp; Save the file to your computer and use an infile statement to read the data from the file into a SAS data set.&amp;nbsp; Read the entire name into one variable, using a character variable length of 23.&amp;nbsp;&amp;nbsp; Store formats for the dates with the data set.&amp;nbsp; Write three proc print steps that result in three different sets of date formats.&amp;nbsp; Use appropriate titles.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/8850194067944283363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/lesson-4-numeric-formats-and-informats.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/8850194067944283363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/8850194067944283363'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/lesson-4-numeric-formats-and-informats.html' title='Lesson 4:  Numeric Formats and Informats'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s72-c/SAS_TPTK_logo.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-8030524892186266664</id><published>2012-09-02T11:37:00.000+05:30</published><updated>2013-12-12T08:41:59.890+05:30</updated><title type='text'>Lesson 3:  Appearance of Output, Infile, Labels and Informats</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: 700;&quot;&gt;Keeping Up Appearances&lt;/span&gt;&lt;br /&gt;
Suppose your output doesn&#39;t fit on the page the way you like when you print it or paste it into a word processor.&amp;nbsp; An&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;options statement&lt;/span&gt;&lt;/b&gt;&amp;nbsp;can be used to adjust the number of lines and columns used in the page formatting.&amp;nbsp; In the example below, &quot;ps&quot; stands for &quot;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;pagesize&lt;/span&gt;&lt;/b&gt;&quot; (you can also spell it out if you like).&amp;nbsp; This is the number of lines on a page.&amp;nbsp; Next, &quot;ls&quot; stands for &quot;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;linesize&lt;/span&gt;&lt;/b&gt;&quot; (you can spell this out too), which is the width of a line in characters.&amp;nbsp; If you don&#39;t want the date and time displayed, you can include &quot;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;nodate&lt;/span&gt;&lt;/b&gt;,&quot; and if you&#39;d like to reset the starting page number, &quot;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;pageno=&lt;i&gt;n&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&quot; will do that, where you replace &quot;&lt;i&gt;n&lt;/i&gt;&quot; with the number you want.&amp;nbsp; If page number is not reset, the page numbers keep incrementing in the output window, even if you clear it.&amp;nbsp; There are many more options available (see the help or manuals).&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;433&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS03/SAS3.h02.jpg&quot; width=&quot;487&quot; /&gt;&lt;br /&gt;
&lt;b&gt;Reading from a File&lt;/b&gt;&lt;br /&gt;
Now, back to reading data.&amp;nbsp; Our example data set is small, and easy enough to type in.&amp;nbsp; If the data set is large, it may not be convenient to type everything into the program.&amp;nbsp; In this case, the data may be saved in a text file outside of SAS.&amp;nbsp; Let&#39;s say we had the same data saved in a file called F:\sample.txt.&amp;nbsp;&amp;nbsp;The following program would then have almost the same effect as the previous one (can you tell what will be different?):&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;352&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS03/SAS3.h03.gif&quot; width=&quot;616&quot; /&gt;&lt;br /&gt;
(Since the library isn&#39;t specified, this data will be saved in&amp;nbsp;&lt;i&gt;work&lt;/i&gt;.)&lt;br /&gt;
There are some details to take note of here.&amp;nbsp; It may seem that the&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;font-weight: 700;&quot;&gt;infile&lt;/span&gt;&lt;/span&gt;&amp;nbsp;statement replaces the &quot;cards&quot; section, but that is not what really happens.&amp;nbsp; The infile statement comes before the input statement, whereas the &quot;cards&quot; section comes after the input statement.&amp;nbsp;&amp;nbsp;(In fact, &quot;cards&quot; must always be placed last in the data step.)&amp;nbsp; When you include a &quot;cards&quot; statement, SAS automatically assumes there is a default infile statement that says &quot;&lt;span style=&quot;font-family: Courier;&quot;&gt;infile cards;&lt;/span&gt;&quot; before the input statement.&amp;nbsp; In other words, SAS treats the &quot;cards&quot; section just like an external file.&amp;nbsp; This is confirmed by the fact that it does not appear in the program statements copied to the log. You can explicitly include the&amp;nbsp;&lt;i&gt;infile cards&lt;/i&gt;&amp;nbsp;statement, especially if you need some of the optional commands available with&amp;nbsp;&lt;i&gt;infile&lt;/i&gt;.&amp;nbsp; This will be discussed further in a future lesson.&lt;br /&gt;
There is also an&amp;nbsp;import wizard available from the File Menu.&amp;nbsp;&amp;nbsp;It will load Excel and other popular file types too.&lt;o:p&gt;&amp;nbsp;(One caveat for Excel imports:&amp;nbsp; You must look under the &quot;options&quot; button in the wizard, where there is a check box to indicate whether the first line contains data or variable names.)&amp;nbsp; In Enterprise Guide, this can be accomplished by going to the &quot;Insert&quot; menu and choosing &quot;data.&quot;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight: 700;&quot;&gt;Labels for Variables&lt;/span&gt;&lt;br /&gt;
SAS allows variable names to be 32 characters long.&amp;nbsp; You can have upper and lower case letters, numbers, and underscores, but cannot start with a number.&amp;nbsp; Programming statements do not distinguish between upper and lower case, but the cases are remembered for use in output.&amp;nbsp; This flexibility takes care of most variable naming needs.&amp;nbsp; However, there are times when even more flexibility is desired.&amp;nbsp; Perhaps you want true spaces (not underscores) between words, or special characters that are not allowed.&amp;nbsp; Or maybe you&#39;d like to use a short name like &quot;LEye&quot; in your program, but want the output to say &quot;Left Eye Acuity.&quot;&amp;nbsp; For these situations, SAS allows us to assign&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;labels&lt;/span&gt;&lt;/b&gt;&amp;nbsp;to variables.&amp;nbsp; Labels can be up to 256 characters long and may include almost any text symbols.&amp;nbsp; Labels are assigned in the data step and are stored with the data set.&amp;nbsp; Many SAS procedures, like proc print, can use the labels in producing output.&amp;nbsp; In the example below, note the syntax of the label statement in the data step:&amp;nbsp; The statement begins with the keyword&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;i&gt;label&lt;/i&gt;&lt;/span&gt;, followed by a variable name, equal sign, and the label in quote marks.&amp;nbsp; More labels may be assigned in the same statement.&amp;nbsp; They are listed one after the other separated by spaces (no commas).&amp;nbsp; To use the labels in proc print, the option&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;i&gt;label&lt;/i&gt;&lt;/span&gt;&amp;nbsp;is added to the proc print statement.&amp;nbsp; The example shows the results both without and with the&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;label&lt;/span&gt;&amp;nbsp;option.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;604&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS03/SAS3.h04.jpg&quot; width=&quot;454&quot; /&gt;&lt;br /&gt;
&lt;b&gt;Character Informats&lt;/b&gt;&lt;br /&gt;
So far we&#39;ve discussed reading fairly straight-forward data consisting of numbers or short words.&amp;nbsp; We will now explore more complex data types.&lt;br /&gt;
Consider this example:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;533&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS03/SAS3.h05.jpg&quot; width=&quot;443&quot; /&gt;&lt;br /&gt;
No errors in the log....&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;399&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS03/SAS3.h06.jpg&quot; width=&quot;552&quot; /&gt;&lt;br /&gt;
Why isn&#39;t &quot;Amphitheater&quot; complete?&amp;nbsp; The default length for character variables is eight.&amp;nbsp; SAS has only read eight characters from the data even when more characters are present.&amp;nbsp; We need to tell SAS to make the x variable hold more characters.&amp;nbsp; Try this:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;596&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS03/SAS3.h07.jpg&quot; width=&quot;426&quot; /&gt;&lt;br /&gt;
The &quot;&lt;span style=&quot;font-family: Courier;&quot;&gt;$12.&lt;/span&gt;&quot; expression in the input statement is called an &quot;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;informat&lt;/span&gt;&lt;/b&gt;.&quot;&amp;nbsp; Think of it as an &quot;input format&quot; that tells SAS what to expect the data to look like.&amp;nbsp; The dollar sign signifies that it is a character variable, and the 12 is the length of the field to be read, and also the length of the resulting variable.&amp;nbsp; All informats have a period in them.&amp;nbsp; This is part of the syntax that SAS uses to recognize an informat.&lt;br /&gt;
Let&#39;s look at four more examples to demonstrate the behavior of informats.&amp;nbsp; These examples will use two character variables.&amp;nbsp; In the first example, we show what happens with only dollar signs to indicate that they are character variables.&amp;nbsp; Of course, the values are now cut off at eight characters, but otherwise the data are read correctly:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;524&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS03/SAS3.h08.jpg&quot; width=&quot;426&quot; /&gt;&lt;br /&gt;
Now suppose we attempt to fix the length problem by putting in informats.&amp;nbsp; Then, SAS reads the full 12 characters for x, regardless of whether or not there are spaces included:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;524&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS03/SAS3.h09.jpg&quot; width=&quot;426&quot; /&gt;&lt;br /&gt;
To fix this, we need SAS to treat a space as a delimiter just as it does when a dollar sign is used alone.&amp;nbsp; The &quot;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;colon modifier&lt;/span&gt;&lt;/b&gt;&quot;&amp;nbsp;placed in front of the informat will give this result.&amp;nbsp; In fact, the dollar sign alone is an abbreviation for &quot;&lt;span style=&quot;font-family: Courier;&quot;&gt;:$8.&lt;/span&gt;&quot;.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;524&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS03/SAS3.h10.jpg&quot; width=&quot;426&quot; /&gt;&lt;br /&gt;
The character informat can also be used to create variables shorter than eight characters.&amp;nbsp; For large data sets, this can result in considerable space savings.&amp;nbsp; For example, the data set might contain a variable that is a one-character code (such as M or F for male or female).&amp;nbsp; Using an informat of $1. would then be appropriate, and would save seven bytes of storage for every observation.&lt;br /&gt;
&lt;b&gt;Running out of Line&lt;/b&gt;&lt;br /&gt;
An additional problem occurs when using these techniques to read from an external file.&amp;nbsp; A character informat at the end of a line causes SAS to try to read all of the characters for the width of the field specified by the informat.&amp;nbsp; If the line is shorter than that, errors will be reported in the log and the data will not be read correctly.&amp;nbsp; One solution is to add the option &quot;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;trunc&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;over&lt;/span&gt;&lt;/b&gt;&quot; in the infile statement after the file path.&amp;nbsp; The meaning of &quot;truncover&quot; is something like &quot;keep reading over the whole field even if the line is truncated.&quot;&amp;nbsp; (This problem does not occur with instream data.)&amp;nbsp; A colon modifier with the informat can often solve this problem, too.&lt;br /&gt;
There is a related option, &quot;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;missover&lt;/span&gt;&lt;/b&gt;&quot; that can also be used when there are not enough variable values at the end of the line and you want the remaining ones set to missing in the SAS data set.&amp;nbsp; Without &quot;missover&quot;, SAS would go to the next line and try to continue reading the input variables for which it did not find values.&amp;nbsp; The two options behave almost identically.&amp;nbsp; The difference is that missover will set short values to missing when an informat (no colon) is used, while truncover will not.&amp;nbsp; Truncover also does the same thing when more than one value is missing at the end of a line.&lt;br /&gt;
&lt;br /&gt;
Exercises&lt;br /&gt;
From now on, include titles in all your output that give your name, the lesson number, and problem number.&amp;nbsp; Unless otherwise directed, do not change data sets, and turn in your editor, log, and output.&lt;br /&gt;
1.&amp;nbsp; Download the file at this&amp;nbsp;&lt;a href=&quot;http://galsterhome.com/stats/Tutorial/MiscDocs/ex42data.txt&quot;&gt;link&lt;/a&gt;.&amp;nbsp; It contains four variables, FirstName, LastName, Age, and Score.&amp;nbsp; Write a SAS program to read this data from the external file and print it to the output window.&amp;nbsp; Save the data set in a library that you specify (not&amp;nbsp;&lt;i&gt;work&lt;/i&gt;).&amp;nbsp; Experiment with title and options statements to change the appearance of your output.&lt;br /&gt;
2.&amp;nbsp; Copy the data below into the SAS editor and write a data step to read it, followed by a proc step to print it (to the output window).&amp;nbsp; Make sure the printout matches the original data.&amp;nbsp; The variables are first and last name, sex, and age.&amp;nbsp; Include labels in your data set and output.&amp;nbsp; Also include a two-line title and suppress the printing of the time and date on each page.&lt;br /&gt;
&lt;pre&gt;Andy Stewart M 47
Martha Gustafson F 55
Marissa Maneschevitz F 32
John Fitzgerald M 28
Jacqueline Martin F 33&lt;/pre&gt;
3.&amp;nbsp; Download the file at this&amp;nbsp;&lt;a href=&quot;http://galsterhome.com/stats/510docs/ex43data.txt&quot;&gt;link&lt;/a&gt;.&amp;nbsp; Similar to a previous exercise, it contains four variables, Age,&amp;nbsp; Score, LastName, and FirstName.&amp;nbsp; Examine the data file carefully, then write a SAS program to read this data from the external file and print it to the output window.&amp;nbsp; Include an appropriate title.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/8030524892186266664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/lesson-3-appearance-of-output-infile.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/8030524892186266664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/8030524892186266664'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/lesson-3-appearance-of-output-infile.html' title='Lesson 3:  Appearance of Output, Infile, Labels and Informats'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s72-c/SAS_TPTK_logo.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-1411156935952947097</id><published>2012-09-02T11:35:00.003+05:30</published><updated>2013-12-12T08:41:41.152+05:30</updated><title type='text'>Lesson 2:  Data Sets and Libraries</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;b&gt;Data Sets&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
SAS stores data in “SAS data sets,” using its own internal database format.&amp;nbsp; If you are familiar with any database software (Oracle, Sybase, Dbase, MS Access, etc.), you will find that data sets correspond to tables in a database program.&amp;nbsp;&amp;nbsp;The rows are called&amp;nbsp;&lt;i&gt;observations&lt;/i&gt;&amp;nbsp;(database &quot;records&quot;), and the columns are called&amp;nbsp;&lt;i&gt;variables&lt;/i&gt;&amp;nbsp;(database &quot;fields&quot;).&amp;nbsp; In the example data set below, x, y, z, and w are variables, while 1, 2, 3, and 4 are observation numbers.&amp;nbsp; It is also becoming more common to use the database terms with SAS, so it is good to be aware of both terminologies.&amp;nbsp; Rows=Observations=Records.&amp;nbsp; Columns=Variables=Fields.&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;122&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS02/SAS2.h1.gif&quot; width=&quot;245&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
However, data sets contain more than just variables and observations.&amp;nbsp; Such things as how values are to be printed, labels to use instead of variable names, and sorting and indexing information can also be included.&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
As you learn about SAS, you will see that SAS gives you a great deal of control over almost any aspect of your work that you might think of.&amp;nbsp; However, greater control is obtained by using more complex program statements.&amp;nbsp; So, SAS has many &quot;default&quot; settings that save you from extra work and headaches as long as you are satisfied with what is specified by the default.&amp;nbsp; Therefore, many standard actions can be accomplished by very short SAS commands.&amp;nbsp; When there is need for more control, additional commands are available.&amp;nbsp; The first of these &quot;defaults&quot; that we will encounter concerns where data sets are stored.&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;font-weight: 700;&quot;&gt;Libraries&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
SAS stores data sets in&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;libraries&lt;/span&gt;&lt;/b&gt;.&amp;nbsp; (They are really just computer directories or folders, but the term comes from the mainframe language.)&amp;nbsp;&amp;nbsp;There is a default library called “&lt;span style=&quot;color: blue;&quot;&gt;&lt;i style=&quot;font-weight: 700;&quot;&gt;work&lt;/i&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;”&amp;nbsp; This is where the data will be placed if you don&#39;t specify another location.&amp;nbsp; However,&amp;nbsp;&lt;i&gt;work&lt;/i&gt;&amp;nbsp;is&amp;nbsp;a&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;temporary&lt;/span&gt;&lt;/b&gt;&amp;nbsp;library, that is, when SAS is closed, all data sets in&amp;nbsp;&lt;i&gt;work&lt;/i&gt;&amp;nbsp;are deleted.&amp;nbsp; However, if you want a data set to be saved permanently, such as in your “My Documents” folder or anywhere else you wish, you can tell SAS to designate a&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;permanent library&lt;/span&gt;&lt;/b&gt;&amp;nbsp;using a&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;libname&lt;/b&gt;&lt;/span&gt;&amp;nbsp;statement.&amp;nbsp; The libname statement will look something like this:&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;font-family: Courier;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;77&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS02/SAS2.h2.jpg&quot; width=&quot;415&quot; /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;There are three parts to this command.&amp;nbsp; The first part is the keyword &quot;libname&quot; which tells SAS you want to define a new library.&amp;nbsp; The second part, &quot;myownlib&quot; is the name that SAS will use to refer to this library.&amp;nbsp; This is called the&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;libref&lt;/span&gt;&lt;/b&gt;.&amp;nbsp; You can supply any name you like here, as long as it meets the&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;guidelines for allowed names,&amp;nbsp;&lt;/span&gt;&lt;/b&gt;which are:&amp;nbsp; you can use letters, numbers, and underscores, but can&#39;t start with a number.&amp;nbsp; A libref can only be eight characters long, though SAS variable names can be up to 32 characters.&amp;nbsp; The third part of the statement is the&amp;nbsp;&lt;a href=&quot;http://galsterhome.com/stats/Tutorial/MiscDocs/pathnames.htm&quot;&gt;pathname&lt;/a&gt;&amp;nbsp;(DOS style) showing the actual location of the folder or directory you want to use.&amp;nbsp; It is enclosed in quotes (single or double).&amp;nbsp; On some Windows systems,&amp;nbsp;&lt;b&gt;&#39;Desktop&#39;&amp;nbsp;&lt;/b&gt;and &#39;&lt;b&gt;My Documents&#39;&amp;nbsp;&lt;/b&gt;can be used and will automatically be assigned to the correct path.&amp;nbsp;&amp;nbsp;&lt;b&gt;&#39;A:&#39;&lt;/b&gt;&amp;nbsp;usually works to assign the floppy drive, but only if there is a disk in the drive (applies to any removable volume).&amp;nbsp; Note: The libname statement does not create a folder.&amp;nbsp; It essentially creates a shortcut or alias to an existing folder.&amp;nbsp; We call the library &quot;permanent&quot; because the data is not deleted when SAS closes, but the libref itself will normally have to be recreated in future SAS sessions.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;The illustration below shows the SAS Explorer pane (from the left side of the SAS window, note the tab at the bottom) displaying the currently defined libraries.&amp;nbsp; Some of these libraries are standard in SAS.&amp;nbsp; The one called &quot;Rao&quot; has been created with a libname statement.&amp;nbsp; Note that &quot;Work&quot; is explicitly listed.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;312&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS02/SAS2.h3.jpg&quot; width=&quot;192&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
If you double-click the &quot;Work&quot; file drawer, the data sets in &quot;Work&quot; become visible.&amp;nbsp; The spreadsheet icon in the example below represents a data set named &quot;One.&quot;&amp;nbsp; If you double-click on &quot;One&quot; it will open in a &quot;Viewtable,&quot; a spreadsheet-like view.&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;262&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS02/SAS2.h4.jpg&quot; width=&quot;528&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
The viewtable has two modes, &quot;Edit&quot; and &quot;Browse.&quot;&amp;nbsp; In browse mode, you cannot change the data.&amp;nbsp; To switch modes, go to the &quot;Edit&quot; menu and select the mode you want.&amp;nbsp; A new data set can be created by selecting &quot;Table Editor&quot; under the &quot;Tools&quot; menu.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
(Note:&amp;nbsp; In order to go back to previous windows in the explorer pane, you press the folder with the up arrow on it.&amp;nbsp; But this will disappear if the &quot;Explorer&quot; is not the active window.&amp;nbsp; Click on the &quot;Explorer&quot; window to bring it back.)&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;(Note:&amp;nbsp; There is also another &quot;Explorer&quot; under the &quot;View&quot; menu.&amp;nbsp; This opens a window much like a Windows Explorer.)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
When you create a SAS data set, you give it a name, such as &quot;One&quot; in the example above.&amp;nbsp; Names can contain letters, numbers, and underscores, but cannot start with a number.&amp;nbsp; They can be up to 32 characters long.&amp;nbsp; You can refer to a data set in the&amp;nbsp;&lt;i&gt;work&lt;/i&gt;&amp;nbsp;directory by its name alone, because that is the default location.&amp;nbsp; But data sets are actually identified by “two-level names,” where the library is given first, followed by a dot, then the dataset name.&amp;nbsp; In other words, the form is&amp;nbsp;&lt;i&gt;libref.datasetname&lt;/i&gt;.&amp;nbsp;&amp;nbsp;Since&amp;nbsp;&lt;i&gt;work&lt;/i&gt;&amp;nbsp;is the default library,&amp;nbsp;&lt;i&gt;datasetname&lt;/i&gt;&amp;nbsp;alone is equivalent to&amp;nbsp;&lt;i&gt;work.datasetname&lt;/i&gt;.&amp;nbsp; In order to store a dataset permanently, specify a two-level name, with a first level being a defined libname other than&amp;nbsp;&lt;i&gt;work&lt;/i&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
In rare cases, you may want to change the default library to something other than work. To do this, use the special libref &quot;user&quot; (&lt;span style=&quot;font-family: Courier;&quot;&gt;libname user &#39;C:\folder1\myfolder&#39;;&lt;/span&gt;).&amp;nbsp; This allows you to use a one-level name with a permanent library that you specify.&amp;nbsp; It does not change which libraries are permanent and temporary.&amp;nbsp; To create temporary data sets when the default library has been changed, use a two-level name with &quot;work&quot; in the first position.&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
There is also a way to export data in some common file formats.&amp;nbsp; See &quot;File--&amp;gt;Export Data.&quot;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
In Enterprise Guide, the datasets appear in the project tree under the code that created them.&amp;nbsp; They will be saved when you save your project. (But when you run code you may get a choice of whether or not to replace the existing data.&amp;nbsp; This may affect what is saved in the project.)&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;font-weight: 700;&quot;&gt;Getting Data Into SAS&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
Most of the time, when you begin working on a project in SAS, your data will not be in a SAS data set.&amp;nbsp; In order for SAS to perform analysis tasks, the data will be need to be brought into a SAS data set.&amp;nbsp; Because data may come in so many different forms, SAS is very flexible and provides a variety of ways to do this.&amp;nbsp; We will keep our first examples simple, but be assured that SAS can handle very complex data reading tasks!&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
The simplest way to get data into a SAS data set is using “&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;instream&lt;/b&gt;&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;data&lt;/b&gt;&lt;/span&gt;.”&amp;nbsp;&amp;nbsp;This means the data is included “in the stream” of the programming statements that will load it. Here is an example.&amp;nbsp;&amp;nbsp;An explanation of the program follows.&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;261&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS02/SAS2.h5.gif&quot; width=&quot;355&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
The first two lines are&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;c&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;omments&lt;/span&gt;&lt;/b&gt;.&amp;nbsp; A comment is simply text inserted into computer code that the programming language will ignore.&amp;nbsp; Comments are often used to explain what is happening in the program (for others or for future reference).&amp;nbsp; Sometimes they are used to temporarily disable some statements in the program.&amp;nbsp; Sometimes they are used to &quot;beautify&quot; or enhance the readability of the program.&amp;nbsp; In SAS, there are two ways to write comments.&amp;nbsp; A statement that begins with an asterisk and ends with a semicolon is a comment.&amp;nbsp; This type of comment will only work for one statement at a time.&amp;nbsp; If a larger section of a program is to be commented, that is, multiple statements in one group, you can use &quot;/*&quot; to begin the comment and &quot;*/&quot; to close it.&amp;nbsp; Even semicolons are ignored by this syntax.&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
The third line contains a&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;libname&lt;/b&gt;&lt;/span&gt;&amp;nbsp;definition.&amp;nbsp;&amp;nbsp;The library will be called “mysaslib” and the actual folder location on your computer is given in the quote marks.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
The fourth line begins with the keyword &quot;data,&quot; which tells SAS this is the beginning of a data step.&amp;nbsp; We can see by the two-level name that the&amp;nbsp;dataset will be called “myfirst” and will be stored in the “mysaslib” library.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
The fifth line, the input statement, tells SAS what variables to put into the data set.&amp;nbsp;&amp;nbsp;Each variable name may need to be followed by a code that tells SAS what kind of variable it is and how to read it.&amp;nbsp; These codes are called&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;informats.&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&amp;nbsp;However, there is a default for this, called &quot;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;standard numeric&lt;/span&gt;&lt;/b&gt;,&quot; which is just an ordinary number in decimal form, with no commas.&amp;nbsp; Since &quot;age&quot; fits this description, we do not have to include an informat for it.&amp;nbsp; On the other hand, &quot;name&quot;&amp;nbsp; is a&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;character&lt;/span&gt;&lt;/b&gt;&amp;nbsp;variable.&amp;nbsp; The&amp;nbsp;&quot;$&quot; tells SAS to read &quot;name&quot; as character variable eight characters long.&amp;nbsp; Character variables have no numeric value, and can contain letters, numbers, and most other symbols.&amp;nbsp; They are also known as &quot;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;strings&lt;/b&gt;&lt;/span&gt;.&quot;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
The “&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;cards&lt;/b&gt;&lt;/span&gt;” statement tells SAS that the list of data to read is coming next&amp;nbsp;(&quot;datalines&quot; and &quot;lines&quot; may be used as synonyms for &quot;cards&quot;).&amp;nbsp; The data are organized in a straightforward way.&amp;nbsp;&amp;nbsp;Each observation is on one line and the variable values are separated by spaces.&amp;nbsp;&amp;nbsp;This is called “list input.”&amp;nbsp;&amp;nbsp;A semicolon on a line by itself indicates the end of the data.&amp;nbsp; (The data are not program statements, so there are no semicolons in the data list.)&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
In addition to comments, we can use&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;indenting&lt;/span&gt;&lt;/b&gt;&amp;nbsp;to make our programs more readable.&amp;nbsp; For example, the statements under a data or proc statement can be indented to make the the steps look like an outline.&amp;nbsp; Data given in cards should be placed along the margin, though.&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
Next, SAS encounters a proc statement, and will therefore compile and execute the data step before going on.&amp;nbsp;&amp;nbsp;The dataset “myfirst” is now created and populated with three observations.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
SAS continues by compiling the proc step, which consists of only the&amp;nbsp;&amp;nbsp;“proc print” statement.&amp;nbsp;&amp;nbsp;Without any other commands specified, this will cause the default action of printing the most recently created data set, which, of course, is “myfirst.”&amp;nbsp;&amp;nbsp;Print does NOT mean &quot;print to the printer.&quot;&amp;nbsp; Proc print produces a formatted &quot;printout&quot; of the data set in the output window.&amp;nbsp; You can save or print (really) this output using File Menu commands.&amp;nbsp;&amp;nbsp;The result looks like this:&lt;br /&gt;
&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS02/SAS2.h6.gif&quot; width=&quot;511&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
In case you do not want to use the default (last created) data set, or just want to your program to be more obvious to the reader, you can specify the data set that proc print will use this way:&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;87&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS02/SAS2.h7.gif&quot; width=&quot;377&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;b&gt;Using Titles&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
SAS provides several ways to modify the appearance of the output it produces.&amp;nbsp; Notice that in our example the heading &quot;The SAS System&quot; together with the time, date, and page number appear at the top of the page.&amp;nbsp; &quot;The SAS System&quot; is the default page&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;title&lt;/span&gt;&lt;/b&gt;.&amp;nbsp; You can supply your own titles by using title statements, as shown here:&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;433&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS03/SAS3.h01.jpg&quot; width=&quot;425&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
You can have multiple lines of titles.&amp;nbsp; Just add more title statements with higher numbers.&amp;nbsp; Title statements are global; they don&#39;t belong to a particular proc and are in effect until changed or deleted.&amp;nbsp; Redefining a title deletes all previously defined titles of that number or higher.&amp;nbsp; To delete a title without replacing it, just include a blank title statement, like &quot;&lt;span style=&quot;font-family: Courier New;&quot;&gt;title3;&lt;/span&gt;&quot; .&amp;nbsp; This will delete the old title3, as well as title4 or any other higher-numbered titles.&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;font-weight: 700;&quot;&gt;Producing HTML (web page) output&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
Both PC SAS and Enterprise Guide can produce HTML or text output.&amp;nbsp; Enterprise Guide displays HTML by default:&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;484&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS02/SAS2.h8.gif&quot; width=&quot;646&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
Pretty, isn&#39;t it?&amp;nbsp; To get HTML in PC SAS, you can go to &quot;Tools--&amp;gt;Options--&amp;gt;Preferences,&quot; click the &quot;Results&quot; tab, then check &quot;Create HTML.&quot;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;a href=&quot;http://galsterhome.com/stats/Tutorial/SAS01.htm&quot;&gt;&amp;lt;&amp;lt;Previous&lt;/a&gt;|&lt;a href=&quot;http://galsterhome.com/stats/Tutorial/sas_tutorial_contents.htm&quot;&gt;Contents&lt;/a&gt;|&lt;a href=&quot;http://galsterhome.com/stats/Tutorial/SAS03.htm&quot;&gt;Next&amp;gt;&amp;gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
Exercises&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
Submit one Word document with all answers either typed in or copied in.&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
1.&amp;nbsp; Indicate which of the following are valid names for variables and&amp;nbsp; librefs (two questions).&amp;nbsp;&lt;/div&gt;
&lt;ol style=&quot;text-align: start;&quot; type=&quot;a&quot;&gt;
&lt;li&gt;sales&lt;/li&gt;
&lt;li&gt;SALES&lt;/li&gt;
&lt;li&gt;Sales&lt;/li&gt;
&lt;li&gt;Sales.12&lt;/li&gt;
&lt;li&gt;Sales.Month.12&lt;/li&gt;
&lt;li&gt;12MonthSales&lt;/li&gt;
&lt;li&gt;Month12Sales&lt;/li&gt;
&lt;li&gt;More_Sales&lt;/li&gt;
&lt;li&gt;More&amp;amp;More&lt;/li&gt;
&lt;li&gt;Moore_and_Moore&lt;/li&gt;
&lt;li&gt;Month12&lt;/li&gt;
&lt;li&gt;_Month12_&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
2.&amp;nbsp; If a database has a table with 500 records and 14 fields, how many observations and variables would a SAS dataset containing the same information have?&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
3.&amp;nbsp; If a spreadsheet had 5 columns and 4 rows, how many observations and variables would a SAS dataset containing the same information have?&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
4.&amp;nbsp; Looking at the screen print below, answer the following questions:&lt;/div&gt;
&lt;ol style=&quot;text-align: start;&quot; type=&quot;a&quot;&gt;
&lt;li&gt;Is this a temporary or permanent data set?&lt;/li&gt;
&lt;li&gt;How many observations are there?&lt;/li&gt;
&lt;li&gt;How many variables are there?&lt;/li&gt;
&lt;li&gt;How many records are there?&lt;/li&gt;
&lt;li&gt;How many fields are there?&lt;/li&gt;
&lt;li&gt;How many rows are there?&lt;/li&gt;
&lt;li&gt;How many columns are there?&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;337&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS02/SAS2.h9.jpg&quot; width=&quot;421&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
5.&amp;nbsp; Copy the data below into the SAS editor (use copy and paste) and write a data step to read it, followed by a proc step to print it (to the output window).&amp;nbsp; Make sure the printout matches the original data.&amp;nbsp; The variables are Name, Age, and Grade.&amp;nbsp; Age and Grade are to be read as numeric variables.&amp;nbsp; Allow the data to be saved to the&amp;nbsp;&lt;i&gt;work&lt;/i&gt;&amp;nbsp;directory.&amp;nbsp; (Submit Program, Log, and Output.)&lt;/div&gt;
&lt;pre style=&quot;text-align: start;&quot;&gt;Marissa 13 7
Andy 7 1
Martha 9 3
John 10 4
Larry 11 6&lt;/pre&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
6.&amp;nbsp; Copy the following data into the SAS editor and write a data step to read it into a data set.&amp;nbsp; Print the results in html format.&amp;nbsp; The variables are Field, Fertilizer, and Variety. Submit the Program, Log, and the html output&amp;nbsp; instead of the normal output.&lt;/div&gt;
&lt;pre style=&quot;text-align: start;&quot;&gt;1 A Magnus
2 B Arbin
3 A Carver
4 B Visser
5 A Turnip
6 B Danun&lt;/pre&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
7.&amp;nbsp; Create a libref for a folder on your hard drive and another for a floppy disk.&amp;nbsp; (If you don&#39;t have a floppy disk, you may use a pen drive).&amp;nbsp; Modify the program in problem 5 so that the data set is saved in each location.&amp;nbsp; Use the explorer window and the viewtable to verify that it is actually there.&amp;nbsp; (Submit your program and log for this problem.)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
8.&amp;nbsp; Submit only the program statements (editor) for this problem.&amp;nbsp; Note that to &quot;reference a data set&quot; means to tell a proc, like proc print, which data set to use.&lt;/div&gt;
&lt;ol style=&quot;text-align: start;&quot; type=&quot;a&quot;&gt;
&lt;li&gt;Write a libname statement that assigns the name &quot;SaleData&quot; to a library that corresponds to folder on the C drive with the same name.&amp;nbsp; Then show how you would reference a data set called &quot;January&quot; in that folder.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Write a libname statement that makes the folder in part a the default library and show how you would reference the data set &quot;January&quot; in that folder.&amp;nbsp; Show how you would now reference a temporary dataset called &quot;February&quot;.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/1411156935952947097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/lesson-2-data-sets-and-libraries.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/1411156935952947097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/1411156935952947097'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/lesson-2-data-sets-and-libraries.html' title='Lesson 2:  Data Sets and Libraries'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s72-c/SAS_TPTK_logo.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-8800317112676348909</id><published>2012-09-02T11:16:00.002+05:30</published><updated>2013-12-12T08:41:28.013+05:30</updated><title type='text'>SAS Windows</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;SAS Windows&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;PC SAS&lt;/b&gt;&amp;nbsp;&lt;/span&gt;is a Windows&amp;nbsp;&lt;a href=&quot;http://galsterhome.com/stats/Tutorial/MiscDocs/gui.htm&quot;&gt;GUI&lt;/a&gt;&amp;nbsp;for running SAS.&amp;nbsp;&amp;nbsp;When you open the program, you will notice three windows (probably overlapping) called “&lt;span style=&quot;color: blue;&quot;&gt;Editor&lt;/span&gt;,” “&lt;span style=&quot;color: blue;&quot;&gt;Log&lt;/span&gt;,” and “&lt;span style=&quot;color: blue;&quot;&gt;Output&lt;/span&gt;.”&amp;nbsp;&amp;nbsp;An example appears below.&amp;nbsp; The windows have been arranged so you can see them all.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;602&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS01/SAS1.h1.jpg&quot; width=&quot;630&quot; /&gt;&lt;br /&gt;
The editor window is used to write programs.&amp;nbsp;&amp;nbsp;Text output will appear in the output window, and the log window will contain error messages and other program execution information.&amp;nbsp;&amp;nbsp;The typical process is to type a program in the editor, then&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;submit&lt;/b&gt;&amp;nbsp;&lt;/span&gt;it (running man icon) and look at your log and output results.&amp;nbsp; After a program has been submitted, it remains in the editor, so you can make modifications and submit it again.&lt;br /&gt;
You can save your programs and open previously saved programs from the file menu.&amp;nbsp; However, the &quot;Save&quot; command will apply to the&amp;nbsp;&lt;i&gt;&lt;a href=&quot;http://galsterhome.com/stats/Tutorial/MiscDocs/active.htm&quot;&gt;active&lt;/a&gt;&amp;nbsp;&lt;/i&gt;(top) window.&amp;nbsp; You can save editor, log, or output files, accordingly.&amp;nbsp; An extension of&amp;nbsp; .sas, .log, or .lst&amp;nbsp; (respectively) will be added automatically unless you supply some other extension.&amp;nbsp; (Using .txt may be helpful if you intend to open the file with Notepad or a word processor, but most of the time it is best to stick with SAS&#39;s defaults.)&amp;nbsp; There is one little catch you should remember:&amp;nbsp; In order to open a saved program, an editor window must be active when you select &quot;Open&quot; from the file menu.&amp;nbsp; If you have closed your editor window, you must first open a new one by selecting &quot;Enhanced Editor&quot; from the &quot;View&quot; menu, then proceed to the &quot;File--&amp;gt;Open&quot; dialog..&lt;br /&gt;
If you have font problems (incorrect characters) when you open an output file in a word processor, try changing the font to &quot;SAS Monospace.&quot;&amp;nbsp; This should work if you are on a computer with SAS installed.&amp;nbsp; If SAS is not installed, you may not be able to get all of the characters correct, but any monospace font, like Courier, will straighten out most of the formatting.&lt;br /&gt;
Take a look at the program statements in the editor window.&amp;nbsp; Notice that each line ends with a&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;semicolon&lt;/span&gt;&amp;nbsp;&lt;/b&gt;.&amp;nbsp; SAS uses semicolons to define the end of a statement.&amp;nbsp; It doesn&#39;t matter how the text is arranged, whether there are extra spaces, indentions, extra lines, multiple statements on a line, or statements split across lines.&amp;nbsp; Such formatting can, and&amp;nbsp;&lt;i&gt;should,&lt;/i&gt;&amp;nbsp;be used to enhance readability&amp;nbsp;&lt;i&gt;for humans&lt;/i&gt;, but to SAS all that matters is where the semicolons are.&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;Enterprise Guide&lt;/b&gt;&amp;nbsp;&lt;/span&gt;is a new environment for running SAS.&amp;nbsp; Although the same programs work and produce similar results, there are some differences in the appearance and behavior of the interface.&amp;nbsp; If you purchase the &quot;SAS Learning Edition,&quot; this is the interface that will be presented after it is installed.&amp;nbsp; An example appears below.&amp;nbsp; In Enterprise Guide, your work is organized into projects, which appear in a collapsible tree structure on the left.&amp;nbsp; The three windows mentioned above do not open automatically.&amp;nbsp; In order to type in a program, you open a&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;code&lt;/b&gt;&amp;nbsp;&lt;/span&gt;window which replaces the editor.&amp;nbsp; Output windows open as needed when programs run, but not necessarily automatically.&amp;nbsp; Output, log, and code windows (also datasets) can be opened by double-clicking icons in the project tree. The contents do not accumulate in the log and output windows as they do in PC SAS.&amp;nbsp; When you submit a program, you have the choice of overwriting previous output or starting a new node in the project tree.&amp;nbsp; This keeps your results more organized.&amp;nbsp; Note, the &quot;running man&quot; icon that is used for &quot;submit&quot; in the old version is replaced by a sheet of paper with a down-arrow beside it.&lt;br /&gt;
You can use the regular interface described under &quot;PC SAS&quot; with Learning Edition, but you have to find the sas.exe file in the program files directory.&amp;nbsp; Make a shortcut to this file and place it on your desktop to use for starting SAS.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;283&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS01/SAS1.h2.gif&quot; width=&quot;481&quot; /&gt;&lt;br /&gt;
&lt;b&gt;Help&lt;/b&gt;&lt;br /&gt;
When you need more information about making SAS do what you want, there are several sources you can access.&amp;nbsp; The first is the &quot;Help&quot; facility installed on your computer and found at the right end of the menu bar.&amp;nbsp; Unfortunately, because SAS is a huge and powerful product, the help can be a challenge to navigate.&amp;nbsp; The appearance and content of your help menu may vary depending on the version of SAS you are working with.&amp;nbsp; The examples here use version 9.1.3.&amp;nbsp; Under &quot;Help,&quot; select &quot;SAS Help and Documentation.&quot;&amp;nbsp; Then you should see a window like this:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;450&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS01/SAS1.h3.jpg&quot; width=&quot;550&quot; /&gt;&lt;br /&gt;
Click on the plus sign by SAS Products and the tree opens like this:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;450&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS01/SAS1.h4.jpg&quot; width=&quot;550&quot; /&gt;&lt;br /&gt;
There is an important lesson right here in looking at this list in help.&amp;nbsp; SAS is not just one program.&amp;nbsp; It is a system of interconnected modules (&quot;products&quot;).&amp;nbsp; In some ways it is like Microsoft Office, which has a number of components like Word, Excel, PowerPoint, etc.&amp;nbsp; The list you see under &quot;SAS Products&quot; is not necessarily all of them, and you do not necessarily have all those listed available to you.&amp;nbsp; In this course, we will only be dealing with a few of them, and most of the time, we will be in &quot;Base SAS.&quot;&amp;nbsp; Click the plus sign by &quot;Base SAS&quot; and you will see:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;450&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS01/SAS1.h5.jpg&quot; width=&quot;550&quot; /&gt;&lt;br /&gt;
Again we have a long list of choices.&amp;nbsp; The challenge is to learn where to look for the information you need, because there is simply so much that it can easily cause &quot;information overload.&quot;&amp;nbsp; As you begin learning, the most helpful sources of information will be under &quot;SAS Command Reference,&quot; &quot;SAS Procedures,&quot; or &quot;SAS Language Dictionary.&quot;&amp;nbsp; Spend some time looking around in &quot;Help&quot; and familiarizing yourself with what is there.&amp;nbsp; Notice that there are also index and search facilities.&amp;nbsp; Unfortunately, these often return too many &quot;hits&quot; from modules other than those you are interested in.&amp;nbsp; Thus, there is no substitute for learning to navigate the help tree!&lt;br /&gt;
SAS also provides&amp;nbsp;&lt;a href=&quot;http://support.sas.com/onlinedoc/913/&quot;&gt;SAS OnlineDoc 9.1.3 for the Web&lt;/a&gt;&amp;nbsp;which is similar to the help but may be more up-to-date.&amp;nbsp; In fact, you can download it in&amp;nbsp;&lt;a href=&quot;http://support.sas.com/documentation/onlinedoc/91pdf/index_913.html&quot;&gt;PDF&lt;/a&gt;&amp;nbsp;form and print whatever you want.&amp;nbsp; The Online version has a search facility which allows you to restrict your search to a particular module or procedure.&amp;nbsp; In some cases this can be extremely helpful for avoiding unwanted hits.&lt;br /&gt;
&lt;b&gt;Program Organization&lt;/b&gt;&lt;br /&gt;
A&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;statement&lt;/span&gt;&amp;nbsp;&lt;/b&gt;in SAS is sort of like a complete sentence (although the analogy won&#39;t extend as far as having a subject and verb) or a single command.&amp;nbsp; Every statement must end with a semicolon, which signals the end of a command.&amp;nbsp; Inside a statement you will find such things as&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;keywords&lt;/span&gt;&amp;nbsp;&lt;/b&gt;,&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;options&lt;/span&gt;&amp;nbsp;&lt;/b&gt;, and user-supplied&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;names&lt;/span&gt;&amp;nbsp;&lt;/b&gt;.&amp;nbsp; SAS is pretty flexible in its ability to interpret words within a statement.&amp;nbsp; For example, you can separate words with spaces, tabs, or returns--any white space will be treated the same way.&amp;nbsp; You can split statements across multiple lines or put multiple statements on one line.&amp;nbsp; We will try to develop a style that is easy to read and follow by using indentation and comments.&amp;nbsp; SAS is also forgiving, in that it tries to figure out things that might be mistakes.&amp;nbsp; For example, you can put two statements together without a space, because as long as a semicolon is there, SAS can tell where one ends and the next begins.&lt;br /&gt;
SAS is designed for data analysis, so programs are organized into “&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;b&gt;steps&lt;/b&gt;&amp;nbsp;&lt;/span&gt;” that correspond roughly to steps you go through in analyzing data.&amp;nbsp;&amp;nbsp;However, these steps are not just a matter of programming style.&amp;nbsp; They are blocks of code that SAS treats as a whole.&amp;nbsp; Some information is passed from one step to the next, but you should think of steps as independent units.&lt;br /&gt;
There are&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;data steps&lt;/b&gt;&amp;nbsp;&lt;/span&gt;and&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;proc steps&lt;/b&gt;&amp;nbsp;&lt;/span&gt;.&amp;nbsp;&amp;nbsp;The main purpose of data steps is to create data sets.&amp;nbsp;&amp;nbsp;Proc steps may perform analysis tasks or other actions.&amp;nbsp; Every data step begins with the keyword &quot;data&quot; and every proc step begins with the keyword &quot;proc.&quot;&amp;nbsp; (How logical is that?)&amp;nbsp; A &quot;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;b&gt;run&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&quot; statement can signal the end of a step (we will deal with exceptions later) and triggers execution of statements preceding it.&amp;nbsp; A step always ends when another statement that begins with &quot;data&quot; or &quot;proc&quot; is encountered, signaling a new step.&amp;nbsp; Most of the time there must be a &quot;run&quot; statement at the end of a program or the last step will not be executed.&amp;nbsp; Some procs also require a &quot;&lt;b&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;quit&lt;/span&gt;&amp;nbsp;&lt;/b&gt;&quot; statement in order to stop them completely.&lt;br /&gt;
Some commands are called &quot;&lt;b&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;global statements&lt;/span&gt;&amp;nbsp;&lt;/b&gt;&quot;&amp;nbsp;because they are not really part of a step.&amp;nbsp;Some examples are &quot;options,&quot; &quot;title,&quot; and &quot;libname&quot; statements, which will be described later.&amp;nbsp; The effects of these commands typically hold across many steps.&lt;br /&gt;
We should understand the flow of events after a program is submitted.&amp;nbsp; In most cases, SAS first reads all the commands in a step, checks them for errors, then executes the instructions before going on to the next step.&amp;nbsp; If errors are found, SAS writes error messages and warnings to the log.&amp;nbsp; If there are serious errors, SAS will not execute the statements in the step.&amp;nbsp; If another step follows, SAS will go on and try to run the next step.&amp;nbsp; This may produce unexpected results if a later step depends on output from a previous step that had errors.&amp;nbsp; So, errors do not always cause SAS to stop reading and executing code.&amp;nbsp; This is why it is important to&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;ALWAYS CHECK THE LOG&lt;/span&gt;&amp;nbsp;&lt;/b&gt;.&amp;nbsp; You may get output that looks fine, but was produced&amp;nbsp;&lt;i&gt;in spite of&amp;nbsp;&lt;/i&gt;errors that caused the results to be wrong!&lt;br /&gt;
A step could be just one line of code, but it could also be many lines.&amp;nbsp;&amp;nbsp;The program shown below has four steps.&amp;nbsp; Each begins with a keyword, either &quot;data&quot; or &quot;proc,&quot; and ends with a run statement (even though it is redundant to place a &quot;run&quot; before another data or proc step,&amp;nbsp; it turns out to be useful in some cases).&amp;nbsp; Don&#39;t worry about the meaning of the other statements right now, but study the structure of the steps.&amp;nbsp; Note how the editor separates the steps with horizontal lines and adds color codes to various elements of syntax.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;340&quot; src=&quot;http://galsterhome.com/stats/Tutorial/SAS01/SAS1.h6.gif&quot; width=&quot;465&quot; /&gt;&lt;br /&gt;
Incidentally, SAS has two editors.&amp;nbsp; The one that opens by default in PC SAS is the &quot;Enhanced Editor.&quot;&amp;nbsp; We may explore uses of the other editor later, but for now we&#39;ll stick to this one.&amp;nbsp; If you ever need to open another editor window (such as if you have closed one, or you want to have two programs showing at once), choose &quot;Enhanced Editor&quot; rather than &quot;Program Editor&quot; in the &quot;View&quot; menu.&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;a href=&quot;http://galsterhome.com/stats/Tutorial/sas_tutorial_contents.htm&quot;&gt;&amp;lt;&amp;lt;Contents&lt;/a&gt;|&lt;a href=&quot;http://galsterhome.com/stats/Tutorial/SAS02.htm&quot;&gt;Next&amp;gt;&amp;gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
Exercises:&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
The following may be copied into a word processing document, which may be edited to answer the questions and then submitted.&amp;nbsp; There is no need to run SAS programs for these exercises.&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
1.&amp;nbsp; How many steps are there in the following program?&amp;nbsp; Mark the beginning and end of each step and label it as a data or proc step.&lt;/div&gt;
&lt;pre&gt;data one;
do x=1 to 1000;
y=int(ranuni(0)*6+1);
output;
end;
run;
proc freq;
tables y;
data two;
set one;
z=7-y;
run;
proc freq;
tables z;
run;&lt;/pre&gt;
&lt;div align=&quot;left&quot;&gt;
2.&amp;nbsp; Suppose the program above was modified so that an error occurred in the second step.&amp;nbsp; What would probably happen when SAS tried to process the remaining steps? (Be sure you have #1 right!)&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
3.&amp;nbsp; Find three errors in the following program, based on the information in this lesson. (Assume there are no statements split across multiple lines.)&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
data thirsty;&lt;br /&gt;
infile &quot;c:\drinkexp.txt&quot;&lt;br /&gt;
input subject brand rating;&lt;br /&gt;
procprint;run;&lt;br /&gt;
data two;&lt;br /&gt;
set one;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/8800317112676348909/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/sas-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/8800317112676348909'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/8800317112676348909'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/sas-windows.html' title='SAS Windows'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s72-c/SAS_TPTK_logo.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-7787848317744650380</id><published>2012-09-02T11:04:00.002+05:30</published><updated>2013-12-12T08:41:08.318+05:30</updated><title type='text'>A Simple Example</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;i&gt;A Simple Example&lt;/i&gt;&lt;/b&gt;&lt;/h2&gt;
Before getting started on the technical details of SAS programming, we&#39;ll look at a simple example.&lt;br /&gt;
When you open SAS, you will see something similar to the picture below.&amp;nbsp; The three windows on the right, Log, Output, and Editor, will most likely be overlapping.&amp;nbsp; Here they have been arranged so you can see them all.&amp;nbsp; Below these windows there is a task bar with buttons that allows easy switching between windows.&amp;nbsp; The log contains a record of what SAS does, together with error messages and other information.&amp;nbsp; At this point there is already some information in the Log relating to the startup process.&amp;nbsp; On the left, you see a pane called Explorer.&amp;nbsp; Notice there are tabs at the bottom.&amp;nbsp; This pane can be switched between Explorer and Results.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;526&quot; src=&quot;http://galsterhome.com/stats/Tutorial/MiscDocs/simple1.jpg&quot; width=&quot;609&quot; /&gt;&lt;br /&gt;
Now suppose we have some data on course grades and percent attendance, as follows:&lt;br /&gt;
89 90&lt;br /&gt;
98 95&lt;br /&gt;
76 80&lt;br /&gt;
64 55&lt;br /&gt;
85 100&lt;br /&gt;
93 95&lt;br /&gt;
88 95&lt;br /&gt;
79 65&lt;br /&gt;
72 85&lt;br /&gt;
Let&#39;s analyze this data.&lt;br /&gt;
First, we have to get the data into SAS.&amp;nbsp; Here&#39;s a way to do it:&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;298&quot; src=&quot;http://galsterhome.com/stats/Tutorial/MiscDocs/simple2.jpg&quot; width=&quot;225&quot; /&gt;&lt;br /&gt;
This SAS program will create a dataset called &quot;grades&quot; with two variables called &quot;grade&quot; and &quot;attend.&quot;&amp;nbsp; There are nine observations.&amp;nbsp; Type this program into the editor, then submit it by clicking the &quot;running man&quot; icon in the toolbar.&amp;nbsp; The log will show some notes about the creation of the dataset.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;133&quot; src=&quot;http://galsterhome.com/stats/Tutorial/MiscDocs/simple3.jpg&quot; width=&quot;577&quot; /&gt;&lt;br /&gt;
This is the only result you can immediately see from running this program.&amp;nbsp; It doesn&#39;t produce any output, it just creates a dataset.&amp;nbsp; It is important to check the log when running a program like this, or you may not know if it has run correctly.&lt;br /&gt;
The existence of the dataset can also be verified by looking at the explorer pane on the right.&amp;nbsp; Double-click the file-cabinet icon called Libraries, then the file-drawer icon called Work.&amp;nbsp; You will see a spreadsheet-like icon called &quot;Grades.&quot;&amp;nbsp; You can also double-click this icon to open a spreadsheet view of the data.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;106&quot; src=&quot;http://galsterhome.com/stats/Tutorial/MiscDocs/simple4.jpg&quot; width=&quot;167&quot; /&gt;&lt;br /&gt;
Now that we have data in SAS, what can we do with it?&amp;nbsp; Lots of things, of course!&amp;nbsp; But this is a&amp;nbsp;&lt;i&gt;simple&lt;/i&gt;&amp;nbsp;example.&amp;nbsp; We will demonstrate two of the most commonly used&amp;nbsp;&lt;i&gt;procs&lt;/i&gt;&amp;nbsp;(procedures) in SAS.&amp;nbsp; The first is proc print. This will produce formatted output with headings, page numbers, page breaks, and so forth, suitable for printing.&amp;nbsp; It doesn&#39;t actually send the output to the printer, but displays it in the output window. The second is proc plot, which is used for producing simple scatterplots of two variables.&amp;nbsp; The commands for these procedures are shown below, together with the commands that create the dataset.&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;365&quot; src=&quot;http://galsterhome.com/stats/Tutorial/MiscDocs/simple5.jpg&quot; width=&quot;280&quot; /&gt;&lt;br /&gt;
The results of proc print and proc plot will be shown in the output window, and will look something like this (examples here are modified to reduce the size):&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;208&quot; src=&quot;http://galsterhome.com/stats/Tutorial/MiscDocs/simple6.jpg&quot; width=&quot;317&quot; /&gt;&lt;br /&gt;
&lt;img border=&quot;0&quot; height=&quot;395&quot; src=&quot;http://galsterhome.com/stats/Tutorial/MiscDocs/simple7.jpg&quot; width=&quot;354&quot; /&gt;&lt;br /&gt;
That&#39;s the end of our simple example.&amp;nbsp; Now we&#39;re ready to begin in earnest!&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/7787848317744650380/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/a-simple-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/7787848317744650380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/7787848317744650380'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/a-simple-example.html' title='A Simple Example'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s72-c/SAS_TPTK_logo.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-7898277007492125206</id><published>2012-09-02T10:52:00.000+05:30</published><updated>2013-12-12T08:40:29.320+05:30</updated><title type='text'>What is SAS?  Who is SAS?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;i&gt;What is SAS?&amp;nbsp; Who is SAS?&lt;/i&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;SAS&lt;/span&gt;&amp;nbsp;&lt;/b&gt;&amp;nbsp;is produced by the SAS Institute in Cary, NC.&amp;nbsp; It is the most powerful and comprehensive statistics software available.&amp;nbsp;&amp;nbsp;We should avoid calling SAS a &quot;program,&quot; since we write &quot;programs&quot; in SAS.&amp;nbsp; But it is also not appropriate to refer to SAS as a &quot;language&quot; like C++, Fortran, etc.&amp;nbsp; SAS actually contains several computer languages within it.&amp;nbsp;&amp;nbsp;Even &quot;application&quot; doesn&#39;t seem to fully describe SAS, so maybe we should just use the term SAS gives itself at the top of its output, &quot;The SAS System.&quot;&lt;br /&gt;
In 1976 the SAS Institute came out with its first software, a mainframe-based statistical analysis software package.&amp;nbsp; Since then, SAS has enjoyed phenomenal growth.&amp;nbsp; Its software is available for all the major platforms, and has grown beyond statistics to a variety of data management and business applications.&amp;nbsp; To read more about SAS, see their website at&amp;nbsp;&lt;a href=&quot;http://www.sas.com/&quot;&gt;www.sas.com&lt;/a&gt;.&amp;nbsp; A history timeline is given&amp;nbsp;&lt;a href=&quot;http://www.sas.com/presscenter/bgndr_history.html&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
SAS is also a community.&amp;nbsp; Users groups (&lt;a href=&quot;http://support.sas.com/usergroups/sugi/sugi30/whatis.html&quot;&gt;SUGI&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;http://www.sierrainformation.com/nodaksug.htm&quot;&gt;NDSUG&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;http://www.und.nodak.edu/org/rrvsug/index.htm&quot;&gt;RRVSUG&lt;/a&gt;) provide opportunities to interact with other SAS enthusiasts, hold conferences and publish articles about SAS programming techniques.&amp;nbsp; There is even an annual SAS ballot, in which users can vote for the changes and enhancements they would like to see SAS work on.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/7898277007492125206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/what-is-sas-who-is-sas.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/7898277007492125206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/7898277007492125206'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/what-is-sas-who-is-sas.html' title='What is SAS?  Who is SAS?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s72-c/SAS_TPTK_logo.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8311228539257764898.post-4509547166207870277</id><published>2012-09-02T10:49:00.001+05:30</published><updated>2013-12-12T08:39:55.010+05:30</updated><title type='text'>Starting With Sas</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s1600/SAS_TPTK_logo.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;u&gt;&lt;b&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;
&lt;u&gt;&lt;b&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;
&lt;u&gt;&lt;b&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;SAS Tutorial&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;u&gt;&lt;b&gt;Contents&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;u&gt;&lt;i&gt;Chapter 0:&amp;nbsp; Introduction&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
Goals&lt;br /&gt;
What is SAS?&amp;nbsp; Who is SAS?&lt;br /&gt;
A Simple Example&lt;br /&gt;
Homework Guidelines&lt;br /&gt;
&lt;b&gt;--------------SAS Programming I---------------&lt;/b&gt;&lt;br /&gt;
&lt;u&gt;&lt;i&gt;Chapter 1:&amp;nbsp; Elementary Data Step Techniques&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
Lesson 1:&amp;nbsp;&amp;nbsp;Introduction to PC SAS&lt;br /&gt;
Lesson 2:&amp;nbsp;&amp;nbsp;Data Sets and Libraries&lt;br /&gt;
Lesson 3:&amp;nbsp;&amp;nbsp;Appearance, Infile, Labels and Informats&lt;br /&gt;
Lesson 4:&amp;nbsp;&amp;nbsp;Numeric Formats and Informats&lt;br /&gt;
Lesson 5:&amp;nbsp;&amp;nbsp;Input styles&lt;br /&gt;
Lesson 6:&amp;nbsp;&amp;nbsp;Creating Variables&lt;br /&gt;
Lesson 7:&amp;nbsp;&amp;nbsp;Data Set Options, Set and Merge&lt;br /&gt;
&lt;u&gt;&lt;i&gt;Chapter 2:&amp;nbsp; Common SAS Procedures&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
Lesson 8:&amp;nbsp;&amp;nbsp;Proc Print and Proc Sort, with Introduction to ODS&lt;br /&gt;
Lesson 9:&amp;nbsp;&amp;nbsp;Proc Rank, Proc Contents, and Proc Format&lt;br /&gt;
Lesson 10:&amp;nbsp;&amp;nbsp;Proc Univariate and More About ODS&lt;br /&gt;
Lesson 11:&amp;nbsp;&amp;nbsp;Proc Means and Proc Freq&lt;br /&gt;
Lesson 12:&amp;nbsp;&amp;nbsp;Proc Chart, Proc Plot, and Proc Corr&lt;br /&gt;
Lesson 13:&amp;nbsp;&lt;a href=&quot;http://galsterhome.com/stats/Tutorial/SAS14.htm&quot;&gt;&amp;nbsp;&lt;/a&gt;Proc Reg&lt;br /&gt;
Lesson 14:&amp;nbsp;&amp;nbsp;Proc Transpose and Proc Report&lt;br /&gt;
&lt;u&gt;&lt;i&gt;Chapter 3:&amp;nbsp; Advanced Data Step Techniques&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
Lesson 15:&amp;nbsp;&amp;nbsp;Tabs and Other Delimiters&lt;br /&gt;
Lesson 16:&amp;nbsp;&amp;nbsp;Multiple Lines, Multiple Observations&lt;br /&gt;
Lesson 17:&amp;nbsp;&amp;nbsp;Generating Random Data&lt;br /&gt;
Lesson 18:&amp;nbsp;&amp;nbsp;Using Arrays to Program With Variables&lt;br /&gt;
Lesson 19:&amp;nbsp;&amp;nbsp;Project&amp;nbsp; Yahtzee Simulation&lt;br /&gt;
Lesson 20:&amp;nbsp;Data Null&lt;br /&gt;
&lt;u&gt;&lt;i&gt;Chapter 4:&amp;nbsp; Advanced Programming&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
Lesson 21:&amp;nbsp;&amp;nbsp;SQL&lt;br /&gt;
Lesson 22:&amp;nbsp;&amp;nbsp;Macro&lt;br /&gt;
Lesson 23:&amp;nbsp;&amp;nbsp;Introduction to SAS Graph&lt;br /&gt;
&lt;u&gt;&lt;i&gt;Chapter 5:&amp;nbsp; Menu Driven Interfaces&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
Lesson 24:&amp;nbsp;&amp;nbsp;Analyst &amp;amp; Insight&lt;br /&gt;
&lt;b&gt;-------------------SAS Programming II--------------------&lt;/b&gt;&lt;br /&gt;
Video Introduction&lt;br /&gt;
&lt;u&gt;&lt;i&gt;Chapter 6:&amp;nbsp; IML&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
Lesson 25:&amp;nbsp;&amp;nbsp;Introduction to IML&lt;br /&gt;
Lesson 26:&amp;nbsp;&amp;nbsp;Data Sets and Subscripts&lt;br /&gt;
Lesson 27:&amp;nbsp;&amp;nbsp;Headers, Do Loops, and Sampling&lt;br /&gt;
Lesson 28:&amp;nbsp;&amp;nbsp;SAS Data Sets and Matrices&lt;br /&gt;
Lesson 29:&amp;nbsp;&amp;nbsp;Modules&lt;br /&gt;
&lt;u&gt;&lt;i&gt;Chapter 7:&amp;nbsp; Simulations&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
Lesson 30:&amp;nbsp;&amp;nbsp;First Simulation&lt;br /&gt;
Lesson 31:&amp;nbsp;&amp;nbsp;Simulating Power and Significance&lt;br /&gt;
Lesson 32:&amp;nbsp;&amp;nbsp;Power and Regression&lt;br /&gt;
Lesson 33:&amp;nbsp;&amp;nbsp;A Binomial Problem&lt;br /&gt;
Lesson 34:&amp;nbsp;&amp;nbsp;Bootstrap for Model Selection Frequencies&lt;br /&gt;
Lesson 35:&amp;nbsp;Bootstrap II&lt;br /&gt;
Lesson 36:&amp;nbsp;&amp;nbsp;Bootstrap III&lt;br /&gt;
Lesson 37:&amp;nbsp;&amp;nbsp;Bootstrap IV&lt;br /&gt;
&lt;u&gt;&lt;i&gt;Chapter 8:&amp;nbsp; ODS&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
Lesson 38:&amp;nbsp;&amp;nbsp;Creating Excel files and traffic lighting&lt;br /&gt;
Lesson 39:&amp;nbsp;&amp;nbsp;Ods Graphics in Proc Reg&lt;br /&gt;
Lesson 40:&amp;nbsp;&amp;nbsp;Ods Document and Proc Document&lt;br /&gt;
&lt;u&gt;&lt;i&gt;Chapter 9:&amp;nbsp; SAS Graph&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
Lesson 41:&amp;nbsp;&amp;nbsp;Review of SAS Proc Gplot&lt;br /&gt;
Lesson 42:&amp;nbsp;&amp;nbsp;Proc Gplot and Proc Gchart&lt;br /&gt;
Lesson 43:&amp;nbsp;&amp;nbsp;Proc G3D and Proc Contour&lt;br /&gt;
Lesson 44:&amp;nbsp;&amp;nbsp;Proc G3D and Proc Contour&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://saslearninghere.blogspot.com/feeds/4509547166207870277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/starting-with-sas.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/4509547166207870277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8311228539257764898/posts/default/4509547166207870277'/><link rel='alternate' type='text/html' href='http://saslearninghere.blogspot.com/2012/09/starting-with-sas.html' title='Starting With Sas'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYSYzgyQ5tJS1tRfzQUNEgB4z51v157pPS_Xjbr2dS2-5XdkDg2XdQcTd_-axtDidpl4vo1dHL0SyxCHfDZUmq0ZiUsQ_TdK1yH6CdIg4er97R_aJkB6AC2qFlJGm8vDf9VQ0S-myfwbM/s72-c/SAS_TPTK_logo.gif" height="72" width="72"/><thr:total>0</thr:total></entry></feed>