<?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: sas program in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sas-program/m-p/797927#M313728</link>
    <description>&lt;P&gt;Select should not have the SHIPDAYS in the first SELECT statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe you're running into the issue illustrated in Example 4.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p09213s9jc2t99n1vx0omk2rh9ps.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p09213s9jc2t99n1vx0omk2rh9ps.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.fast work.slow work.veryslow;
set hw2.allorders;
where Order_Type=2 or Order_Type=3;
ShipDays=Delivery_Date-Order_Date;
select;
when (ShipDays&amp;lt;3) output work.fast;
when (ShipDays&amp;gt;7) output work.veryslow;
when ((ShipDays&amp;gt;5)and(ShipDays&amp;lt;7)) output work.slow;
otherwise;
end;
drop Employee_ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;FYI - please include the log in your future questions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/417787"&gt;@wxie22&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all!&lt;/P&gt;
&lt;P&gt;below is my code. So the code with the if statement works totally fine. I was trying to do the same thing using a select statement, but I got 0 observations except for ShipDays&amp;lt;3. Does anyone know what's wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data work.fast work.slow work.veryslow;&lt;BR /&gt;set hw2.allorders;&lt;BR /&gt;where Order_Type=2 or Order_Type=3;&lt;BR /&gt;ShipDays=Delivery_Date-Order_Date;&lt;BR /&gt;if ShipDays&amp;lt;3 then output work.fast;&lt;BR /&gt;else if ShipDays&amp;gt;7 then output work.veryslow;&lt;BR /&gt;else if ShipDays&amp;gt;5 and ShipDays&amp;lt;7 then output work.slow;&lt;/P&gt;
&lt;P&gt;drop Employee_ID;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;/*problem1 part b*/&lt;/P&gt;
&lt;P&gt;data work.fast work.slow work.veryslow;&lt;BR /&gt;set hw2.allorders;&lt;BR /&gt;where Order_Type=2 or Order_Type=3;&lt;BR /&gt;ShipDays=Delivery_Date-Order_Date;&lt;BR /&gt;select(ShipDays);&lt;BR /&gt;when (ShipDays&amp;lt;3) output work.fast;&lt;BR /&gt;when (ShipDays&amp;gt;7) output work.veryslow;&lt;BR /&gt;when ((ShipDays&amp;gt;5)and(ShipDays&amp;lt;7)) output work.slow;&lt;BR /&gt;otherwise;&lt;BR /&gt;end;&lt;BR /&gt;drop Employee_ID;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Feb 2022 03:21:00 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2022-02-23T03:21:00Z</dc:date>
    <item>
      <title>sas program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-program/m-p/797920#M313725</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;below is my code. So the code with the if statement works totally fine. I was trying to do the same thing using a select statement, but I got 0 observations except for ShipDays&amp;lt;3. Does anyone know what's wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.fast work.slow work.veryslow;&lt;BR /&gt;set hw2.allorders;&lt;BR /&gt;where Order_Type=2 or Order_Type=3;&lt;BR /&gt;ShipDays=Delivery_Date-Order_Date;&lt;BR /&gt;if ShipDays&amp;lt;3 then output work.fast;&lt;BR /&gt;else if ShipDays&amp;gt;7 then output work.veryslow;&lt;BR /&gt;else if ShipDays&amp;gt;5 and ShipDays&amp;lt;7 then output work.slow;&lt;/P&gt;&lt;P&gt;drop Employee_ID;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;/*problem1 part b*/&lt;/P&gt;&lt;P&gt;data work.fast work.slow work.veryslow;&lt;BR /&gt;set hw2.allorders;&lt;BR /&gt;where Order_Type=2 or Order_Type=3;&lt;BR /&gt;ShipDays=Delivery_Date-Order_Date;&lt;BR /&gt;select(ShipDays);&lt;BR /&gt;when (ShipDays&amp;lt;3) output work.fast;&lt;BR /&gt;when (ShipDays&amp;gt;7) output work.veryslow;&lt;BR /&gt;when ((ShipDays&amp;gt;5)and(ShipDays&amp;lt;7)) output work.slow;&lt;BR /&gt;otherwise;&lt;BR /&gt;end;&lt;BR /&gt;drop Employee_ID;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 01:40:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-program/m-p/797920#M313725</guid>
      <dc:creator>wxie22</dc:creator>
      <dc:date>2022-02-23T01:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: sas program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-program/m-p/797927#M313728</link>
      <description>&lt;P&gt;Select should not have the SHIPDAYS in the first SELECT statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe you're running into the issue illustrated in Example 4.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p09213s9jc2t99n1vx0omk2rh9ps.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p09213s9jc2t99n1vx0omk2rh9ps.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.fast work.slow work.veryslow;
set hw2.allorders;
where Order_Type=2 or Order_Type=3;
ShipDays=Delivery_Date-Order_Date;
select;
when (ShipDays&amp;lt;3) output work.fast;
when (ShipDays&amp;gt;7) output work.veryslow;
when ((ShipDays&amp;gt;5)and(ShipDays&amp;lt;7)) output work.slow;
otherwise;
end;
drop Employee_ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;FYI - please include the log in your future questions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/417787"&gt;@wxie22&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all!&lt;/P&gt;
&lt;P&gt;below is my code. So the code with the if statement works totally fine. I was trying to do the same thing using a select statement, but I got 0 observations except for ShipDays&amp;lt;3. Does anyone know what's wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data work.fast work.slow work.veryslow;&lt;BR /&gt;set hw2.allorders;&lt;BR /&gt;where Order_Type=2 or Order_Type=3;&lt;BR /&gt;ShipDays=Delivery_Date-Order_Date;&lt;BR /&gt;if ShipDays&amp;lt;3 then output work.fast;&lt;BR /&gt;else if ShipDays&amp;gt;7 then output work.veryslow;&lt;BR /&gt;else if ShipDays&amp;gt;5 and ShipDays&amp;lt;7 then output work.slow;&lt;/P&gt;
&lt;P&gt;drop Employee_ID;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;/*problem1 part b*/&lt;/P&gt;
&lt;P&gt;data work.fast work.slow work.veryslow;&lt;BR /&gt;set hw2.allorders;&lt;BR /&gt;where Order_Type=2 or Order_Type=3;&lt;BR /&gt;ShipDays=Delivery_Date-Order_Date;&lt;BR /&gt;select(ShipDays);&lt;BR /&gt;when (ShipDays&amp;lt;3) output work.fast;&lt;BR /&gt;when (ShipDays&amp;gt;7) output work.veryslow;&lt;BR /&gt;when ((ShipDays&amp;gt;5)and(ShipDays&amp;lt;7)) output work.slow;&lt;BR /&gt;otherwise;&lt;BR /&gt;end;&lt;BR /&gt;drop Employee_ID;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 03:21:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-program/m-p/797927#M313728</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-02-23T03:21:00Z</dc:date>
    </item>
  </channel>
</rss>

