<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: What does this SAS Code mean? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-SAS-Code-mean/m-p/419750#M103234</link>
    <description>I know Stata so I know how codes work. I also realize they’re trying to clean raw data into SAS suitable data, I just don’t understand what they’re trying to do by filtering data..if you can explain the details of what exactly is happening, that would be great.&lt;BR /&gt;</description>
    <pubDate>Sat, 09 Dec 2017 00:46:10 GMT</pubDate>
    <dc:creator>hubb</dc:creator>
    <dc:date>2017-12-09T00:46:10Z</dc:date>
    <item>
      <title>What does this SAS Code mean?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-SAS-Code-mean/m-p/419731#M103217</link>
      <description>&lt;P&gt;I am trying to decipher what exactly this code means...the more detailed you can help me answer this the better for me . Thanks so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;libname&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; Analysis &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;"C:/Users/Desktop"&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-weight: 400;"&gt; output1 Analysis.output2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; input1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; date &amp;lt;= &lt;/SPAN&gt;&lt;STRONG&gt;"01Apr2016"d&lt;/STRONG&gt; &lt;SPAN style="font-weight: 400;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; delete;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; LHA = &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;'11'&lt;/SPAN&gt; &lt;SPAN style="font-weight: 400;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; location = &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;'East Kootenay'&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;else&lt;/SPAN&gt; &lt;SPAN style="font-weight: 400;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; LHA = &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;'12'&lt;/SPAN&gt; &lt;SPAN style="font-weight: 400;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; location = &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;'Kootenay Boundary'&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;else&lt;/SPAN&gt; &lt;SPAN style="font-weight: 400;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; LHA = &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;'13'&lt;/SPAN&gt; &lt;SPAN style="font-weight: 400;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; location = &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;'Okanagan'&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;else&lt;/SPAN&gt; &lt;SPAN style="font-weight: 400;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; LHA = &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;'14'&lt;/SPAN&gt; &lt;SPAN style="font-weight: 400;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; location = &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;'TCS'&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;else&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; location = &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;'Non-IHA'&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; location &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;not&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; in (&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;'Non-IHA'&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-weight: 400;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; Analysis.output2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; location in (&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;'Non-IHA'&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-weight: 400;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; output1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-weight: 400;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sort&lt;/STRONG&gt; &lt;SPAN style="font-weight: 400;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; = Analysis.output2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; location;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-weight: 400;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;summary&lt;/STRONG&gt; &lt;SPAN style="font-weight: 400;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; =&amp;nbsp; Analysis.output2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; location;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;var&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; patient_count;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;output&lt;/SPAN&gt; &lt;SPAN style="font-weight: 400;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt; =&amp;nbsp; Analysis.output3 &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-weight: 400;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 22:48:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-SAS-Code-mean/m-p/419731#M103217</guid>
      <dc:creator>hubb</dc:creator>
      <dc:date>2017-12-08T22:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: What does this SAS Code mean?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-SAS-Code-mean/m-p/419733#M103218</link>
      <description>&lt;P&gt;hubb,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think that anyone can teach you the basics of SAS by answering a question on a message board.&amp;nbsp; That work is up to you.&amp;nbsp; To get you started, here are a few questions to consider.&amp;nbsp; Try to answer each of them with a single sentence.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the basic meaning of:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The DATA statement&lt;/LI&gt;
&lt;LI&gt;The SET statement&lt;/LI&gt;
&lt;LI&gt;an IF/THEN statement (OK to use two sentences here)&lt;/LI&gt;
&lt;LI&gt;an ELSE statement&lt;/LI&gt;
&lt;LI&gt;PROC SORT&lt;/LI&gt;
&lt;LI&gt;PROC SUMMARY&lt;/LI&gt;
&lt;LI&gt;a LIBNAME statement&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's OK to skip the OUTPUT statement for now.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 23:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-SAS-Code-mean/m-p/419733#M103218</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-12-08T23:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: What does this SAS Code mean?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-SAS-Code-mean/m-p/419750#M103234</link>
      <description>I know Stata so I know how codes work. I also realize they’re trying to clean raw data into SAS suitable data, I just don’t understand what they’re trying to do by filtering data..if you can explain the details of what exactly is happening, that would be great.&lt;BR /&gt;</description>
      <pubDate>Sat, 09 Dec 2017 00:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-SAS-Code-mean/m-p/419750#M103234</guid>
      <dc:creator>hubb</dc:creator>
      <dc:date>2017-12-09T00:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: What does this SAS Code mean?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-SAS-Code-mean/m-p/419757#M103239</link>
      <description>&lt;P&gt;Throw away older data.&lt;/P&gt;
&lt;P&gt;Recode LHA into new descriptive variable LOCATION.&lt;/P&gt;
&lt;P&gt;Split the data into two output datasets, one for IHA locations and one for the Non_IHA locations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Calculate the total of PATIENT_COUNT for each of the "IHA" locations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could get similar results in one step if you are willing to use the existing LHA values.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary nway data = input1 ;
  where date &amp;gt; "01Apr2016"d 
    and LHA in ('11','12','13','14')
  ;
  class lha ;
  var patient_count;
  output out =  Analysis.output3 sum=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want the LHA values to print in more human readable format then you could just define and attach a format.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format ;
 value $location 
   '11'='East Kootenay'
   '12'='Kootenay Boundary'
   '13'='Okanagan'
   '14'='TCS'
   other='Non-IHA'
 ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2017 02:04:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-SAS-Code-mean/m-p/419757#M103239</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-12-09T02:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: What does this SAS Code mean?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-SAS-Code-mean/m-p/419793#M103255</link>
      <description>&lt;P&gt;This code has to come from a SAS beginner, as it uses unnecessarily complicated constructs. Consider this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data
  output1
  analysis.output2
; * this style of writing the data statement makes immediately clear that more than one dataset is created;
set input1; * use WORK.input1 as source;
where date &amp;gt; "01apr2016"d; * clearer than the if ... then delete;
select (LHA); * use this instead of a long if-then-else-if chain;
  when ('11') location = 'East Kootenay';
  when ('12') location = 'Kootenay Boundary';
  when ('13') location = 'Okanagan';
  when ('14') location = 'TCS';
  otherwise location = 'Non-IHA';
end; * the select block does a recoding of LHA to a new variable;
if location = 'Non-IHA' /* switch the output target according to LHA/location values */
then output output1;
else output analysis.output2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;By using the format created by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, you can replace the select block with a simple put statement.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2017 11:55:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-SAS-Code-mean/m-p/419793#M103255</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-12-09T11:55:28Z</dc:date>
    </item>
  </channel>
</rss>

