<?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 SAS 7613130380 - Lesson 4 - Why the keep statement is before IF-Then statement? in Programming 1 and 2</title>
    <link>https://communities.sas.com/t5/Programming-1-and-2/SAS-7613130380-Lesson-4-Why-the-keep-statement-is-before-IF-Then/m-p/671274#M549</link>
    <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I have this code:&lt;/P&gt;
&lt;PRE&gt;data storm_cat;&lt;BR /&gt;    set pg1.storm_summary;&lt;BR /&gt;    keep Name Basin MinPressure StartDate PressureGroup;&lt;BR /&gt;    *add ELSE keyword and remove final condition;&lt;BR /&gt;    if MinPressure=. then PressureGroup=.;&lt;BR /&gt;    else if MinPressure&amp;lt;=920 then PressureGroup=1;&lt;BR /&gt;    else PressureGroup=0;&lt;BR /&gt;run; &lt;BR /&gt;&lt;BR /&gt;PressureGroup is created after the keep statement. How does keep statement knows about&lt;BR /&gt;PressureGroup?&lt;BR /&gt;&lt;BR /&gt;Your response is greatly appreciated.&lt;BR /&gt;GN&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jul 2020 03:39:53 GMT</pubDate>
    <dc:creator>GN0001</dc:creator>
    <dc:date>2020-07-22T03:39:53Z</dc:date>
    <item>
      <title>SAS 7613130380 - Lesson 4 - Why the keep statement is before IF-Then statement?</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/SAS-7613130380-Lesson-4-Why-the-keep-statement-is-before-IF-Then/m-p/671274#M549</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I have this code:&lt;/P&gt;
&lt;PRE&gt;data storm_cat;&lt;BR /&gt;    set pg1.storm_summary;&lt;BR /&gt;    keep Name Basin MinPressure StartDate PressureGroup;&lt;BR /&gt;    *add ELSE keyword and remove final condition;&lt;BR /&gt;    if MinPressure=. then PressureGroup=.;&lt;BR /&gt;    else if MinPressure&amp;lt;=920 then PressureGroup=1;&lt;BR /&gt;    else PressureGroup=0;&lt;BR /&gt;run; &lt;BR /&gt;&lt;BR /&gt;PressureGroup is created after the keep statement. How does keep statement knows about&lt;BR /&gt;PressureGroup?&lt;BR /&gt;&lt;BR /&gt;Your response is greatly appreciated.&lt;BR /&gt;GN&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 03:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/SAS-7613130380-Lesson-4-Why-the-keep-statement-is-before-IF-Then/m-p/671274#M549</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2020-07-22T03:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: SAS 7613130380 - Lesson 4 - Why the keep statement is before IF-Then statement?</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/SAS-7613130380-Lesson-4-Why-the-keep-statement-is-before-IF-Then/m-p/671280#M552</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I have this code:&lt;/P&gt;
&lt;PRE&gt;data storm_cat;&lt;BR /&gt;    set pg1.storm_summary;&lt;BR /&gt;    keep Name Basin MinPressure StartDate PressureGroup;&lt;BR /&gt;    *add ELSE keyword and remove final condition;&lt;BR /&gt;    if MinPressure=. then PressureGroup=.;&lt;BR /&gt;    else if MinPressure&amp;lt;=920 then PressureGroup=1;&lt;BR /&gt;    else PressureGroup=0;&lt;BR /&gt;run; &lt;BR /&gt;&lt;BR /&gt;PressureGroup is created after the keep statement. How does keep statement knows about&lt;BR /&gt;PressureGroup?&lt;BR /&gt;&lt;BR /&gt;Your response is greatly appreciated.&lt;BR /&gt;GN&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There are statements that SAS refers to as "Declaritive".&lt;/P&gt;
&lt;DIV id="p10bvg3wauedhan1qly0hiokirlv" class="xis-topic"&gt;
&lt;DIV id="p1k16go42b9kyxn18c6u0ul5qn9v" class="xis-subTopic"&gt;
&lt;DIV id="p00048m6k2zlemn1pqwrdn7t4yfg" class="xis-topicContent"&gt;
&lt;DIV id="p1241r614j1njpn1e6buft638ymh" class="xis-paragraph"&gt;&lt;SPAN class="xis-windowItem"&gt;Declarative statements&lt;/SPAN&gt; supply information to SAS and take effect when the system compiles program statements.&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;The order of most of these does not matter though the position may look "odd" in some contexts, especially if you get in a particular coding habit. Exceptions are Data (start a data step) Cards/Cards4/Datalines/Datalines4 which precede in-line data at the end of a step, and the End which ends a DO or Select block. Length may go anywhere but could generate some warnings about variables that exist. &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV id="p10bvg3wauedhan1qly0hiokirlv" class="xis-topic"&gt;
&lt;DIV id="p1k16go42b9kyxn18c6u0ul5qn9v" class="xis-subTopic"&gt;
&lt;DIV id="p00048m6k2zlemn1pqwrdn7t4yfg" class="xis-topicContent"&gt;
&lt;DIV id="p0g5zbkioviottn1sf9op8syhjr8" class="xis-table"&gt;
&lt;TABLE class="tgroup"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="xis-horizontalLeft xis-verticalBottom" colspan="3"&gt;
&lt;DIV id="n1nzq81pygcoton1le4uxqki58fy" class="xis-paraTableFirst"&gt;Declarative Statements&lt;/DIV&gt;
&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="n1okebcqo8yns3n1l0oo1bp69j1f" class="xis-paraTableFirst"&gt;ARRAY&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="n1mlkk3dlzhttun1f3mlrwmdsv6g" class="xis-paraTableFirst"&gt;DATALINES4&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="n1pr6gozgnw1mvn19mzvo17rj62d" class="xis-paraTableFirst"&gt;Labels, Statement&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="p082xhb5iq7gg3n108o66i8xv6yj" class="xis-paraTableFirst"&gt;ATTRIB&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="n0ubswdn7n2ypcn19dz5u2xh10w7" class="xis-paraTableFirst"&gt;DROP&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="n0zqacui6xaji4n17b0ikvkx8xcu" class="xis-paraTableFirst"&gt;LENGTH&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="n1l3oisxboby12n1inp50qauvhxw" class="xis-paraTableFirst"&gt;BY&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="p1u7k97n7cjq6xn1g4uowt3t78aa" class="xis-paraTableFirst"&gt;END&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="n1oltj8kcstqxzn1oh9ib9w2j1xi" class="xis-paraTableFirst"&gt;RENAME&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="p1xaq6j356elrrn176psiwozy5ee" class="xis-paraTableFirst"&gt;CARDS&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="n1t3w6pq284xoan17u395vra18ta" class="xis-paraTableFirst"&gt;FORMAT&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="n12vobb8pk9ogyn1q9b74sd4u5y8" class="xis-paraTableFirst"&gt;RETAIN&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="p0rslle69z0v4vn1f4sa1ev68sam" class="xis-paraTableFirst"&gt;CARDS4&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="p1e19yl5wulle8n10cbcjd7bv8oi" class="xis-paraTableFirst"&gt;INFORMAT&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="n0qglzoq9mztpwn19qgi6ohzi89s" class="xis-paraTableFirst"&gt;WHERE&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="n06w0g36fi0yxnn1w5oddvv43kgk" class="xis-paraTableFirst"&gt;DATA&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="p0l4smv3vz93y5n0zovj43wbf9up" class="xis-paraTableFirst"&gt;KEEP&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="p0c29gpsalarcon1o5fffk403aam" class="xis-paraTableFirst"&gt;WINDOW&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="p09u9h61gdr2g2n1n9hfyh6vfvfp" class="xis-paraTableFirst"&gt;DATALINES&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD class="xis-horizontalLeft xis-verticalTop"&gt;
&lt;DIV id="n0zjtl78hngzp8n1c5am79d3l2ju" class="xis-paraTableFirst"&gt;LABEL&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 22 Jul 2020 04:18:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/SAS-7613130380-Lesson-4-Why-the-keep-statement-is-before-IF-Then/m-p/671280#M552</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-07-22T04:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS 7613130380 - Lesson 4 - Why the keep statement is before IF-Then statement?</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/SAS-7613130380-Lesson-4-Why-the-keep-statement-is-before-IF-Then/m-p/671284#M553</link>
      <description>&lt;P&gt;The keep statement controls what goes to the output dataset(s). It has no effect on the presence of variables within the data step.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 04:54:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/SAS-7613130380-Lesson-4-Why-the-keep-statement-is-before-IF-Then/m-p/671284#M553</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-22T04:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAS 7613130380 - Lesson 4 - Why the keep statement is before IF-Then statement?</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/SAS-7613130380-Lesson-4-Why-the-keep-statement-is-before-IF-Then/m-p/671395#M556</link>
      <description>Hi:&lt;BR /&gt;  Please go back and review the videos that talk about the KEEP and DROP statements. The KEEP statement is setting a flag at compile time that tells SAS which variables need to be sent to the output dataset -- in this case, WORK.STORM_CAT. The variables you list in the KEEP or DROP statement can come from either the INPUT dataset (PG1.STORM_SUMMARY) or the OUTPUT dataset (WORK.STORM_CAT) or you can list variables that you create in the DATA step, (such as PressureGroup).&lt;BR /&gt;&lt;BR /&gt;  Order of the KEEP statement in the program does not matter. The program would work the same way no matter where the KEEP statement was positioned. We recommend putting "housekeeping" statements at the top of the program, but some people are in the habit of putting them at the bottom. It doesn't matter -- KEEP, DROP or WHERE statements can be positioned anywhere in a DATA step program.&lt;BR /&gt;&lt;BR /&gt;Cynthia</description>
      <pubDate>Wed, 22 Jul 2020 14:25:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/SAS-7613130380-Lesson-4-Why-the-keep-statement-is-before-IF-Then/m-p/671395#M556</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2020-07-22T14:25:09Z</dc:date>
    </item>
  </channel>
</rss>

