<?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: Dropping first record with if then statements in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752374#M236986</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/210474"&gt;@Mscarboncopy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Understood. I saved the instructions you gave for next time. I was able to find the issue in the previous code thanks to your suggestions. And I learned a more elegant way to do what I was doing with "if then statements", which always helps me with my long codes. However, I am not sure why the dates (var A)&amp;nbsp; are missing when I use the first suggestion though (from Astounding).&amp;nbsp; I added format A mmddyy10 at the beginning but it did not help.&amp;nbsp; What can I do? Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Context matters.&lt;/P&gt;
&lt;P&gt;Are you talking about this line of code?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;A = coalescec(oldA1, oldA2, oldA3);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If OLDA1 etc are numeric (SAS stores dates a number of days since 1960) instead of character then you will get both the automatic conversion notices and potentially missing values you talk about.&amp;nbsp; Change it to treat the A variables as numbers like it is doing with the B and C variables.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jul 2021 18:09:43 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-07-06T18:09:43Z</dc:date>
    <item>
      <title>Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/751770#M236702</link>
      <description>&lt;P&gt;I am creating variables using variable X with a few if then statements.&lt;/P&gt;&lt;P&gt;My purpose with this is to have variables A B C D instead of A1 A2 A3 etc&amp;nbsp; B1 B2 B3&amp;nbsp; etc. and while this works beautifully, I am losing data for the first record of each ID.&lt;/P&gt;&lt;P&gt;I am not sure how to prevent this from happening.&lt;/P&gt;&lt;P&gt;if X = &lt;STRONG&gt;1&lt;/STRONG&gt; then do;&lt;/P&gt;&lt;P&gt;A= oldA1;&lt;/P&gt;&lt;P&gt;B = oldB1;&lt;/P&gt;&lt;P&gt;C = oldC1;&lt;/P&gt;&lt;P&gt;D = oldD1;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;else if X = &lt;STRONG&gt;2&lt;/STRONG&gt; then do;&lt;/P&gt;&lt;P&gt;A= oldA2;&lt;/P&gt;&lt;P&gt;B = oldB2;&lt;/P&gt;&lt;P&gt;C = oldC2;&lt;/P&gt;&lt;P&gt;D = oldD2;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;else if X = &lt;STRONG&gt;3&lt;/STRONG&gt; then do;&lt;/P&gt;&lt;P&gt;A= oldA3;&lt;/P&gt;&lt;P&gt;B = oldB3;&lt;/P&gt;&lt;P&gt;C = oldC3;&lt;/P&gt;&lt;P&gt;D = oldD3;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this goes to 17. I am using only 3 to make the example easy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;First record is not necessarily X = 1 it can be any key. I could do this with proc transpose but I have a few groups of variables and when I tried with proc transpose it made it worse.&amp;nbsp; How to tell sas to not drop the first record? I can’t seem to find what that is.&lt;/P&gt;&lt;P&gt;Example of the raw data I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID &amp;nbsp;&amp;nbsp;&amp;nbsp;X &amp;nbsp; oldA1 oldB1 oldC1 oldD1 &amp;nbsp;&amp;nbsp;&amp;nbsp; oldA2 oldB2 oldC2 oldD2 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oldA3 oldB3 oldC3 oldD3&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp; &amp;nbsp; 2&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;&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;date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&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;0&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&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;&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;&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;&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; date&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; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&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;&amp;nbsp;&amp;nbsp; 1&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;&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;&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; .&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;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&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;&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;&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;&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; date&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&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;&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;&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;&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; date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 &amp;nbsp; &amp;nbsp; date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&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;&amp;nbsp;&amp;nbsp; 1&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;&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;&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; &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;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I needed:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp; X&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;A &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B &amp;nbsp;&amp;nbsp;C &amp;nbsp;D&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 &amp;nbsp;&amp;nbsp; date&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;I am getting instead&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp; X&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;A &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; B &amp;nbsp;&amp;nbsp;C &amp;nbsp;D&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 15:54:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/751770#M236702</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2021-07-02T15:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/751773#M236704</link>
      <description>&lt;P&gt;The snippet of code you posted in not &lt;STRONG&gt;deleting&lt;/STRONG&gt; any observations.&amp;nbsp; And nothing in your posted code is &lt;STRONG&gt;dropping&lt;/STRONG&gt; any variables.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 16:11:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/751773#M236704</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-02T16:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/751790#M236715</link>
      <description>&lt;P&gt;I checked my raw data file and noticed that all of the ids have missing at least once before the first record for variable X. This is because the file is really big and it has a lot of other variables. So it is skipping the first one immediately after the missing. Not sure what to do in this case.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 17:44:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/751790#M236715</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2021-07-02T17:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/751810#M236721</link>
      <description>&lt;P&gt;It's not 100% clear how you want to handle it when X is missing.&amp;nbsp; But this seems like a good approach, possibly a solution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   A = coalescec(oldA1, oldA2, oldA3);
   B = max(oldB1, oldB2, oldB3);
   C = max(oldC1, oldC2, oldC3);
   D = max(oldD1, oldD2, oldD3);
   drop old: ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Don't forget the colon in the DROP statement.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 19:28:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/751810#M236721</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-07-02T19:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/751942#M236792</link>
      <description>&lt;P&gt;Consider:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  array  olda {17};
  array  oldb {17};
  array  oldc {17};
  array  oldd {17};
  if (1&amp;lt;=x&amp;lt;=17) then do;
    a=olda{x};
    b=oldb{x};
    c=oldc{x};
    d=oldd{x};
  end;
  drop old: ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Jul 2021 04:17:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/751942#M236792</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-07-04T04:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752012#M236823</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; I checked my raw data file and noticed that all of the ids have missing at least once&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I don't see missing IDs in the data you show.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;.&amp;gt; Dropping first record&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I can't see how records could be dropped when the code you show contains no OUTPUT or DELETE statements.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 03:11:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752012#M236823</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-07-05T03:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752013#M236824</link>
      <description>&lt;P&gt;Another way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;A = sum( (X=1)*OLDA1 , (X=2)*OLDA2) , (X=3)*OLDA3 );&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 03:14:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752013#M236824</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-07-05T03:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752309#M236949</link>
      <description>&lt;P&gt;Thank you. This one still drops the first record. I will see what others suggested. I have another question as I like this better than my "if then statements". My date variable is missing. Do I need to do something else in order to prevent this from happening? I am getting this warning for var A which is date in the code:&amp;nbsp;NOTE: Numeric values have been converted to character values at the places given by...&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 13:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752309#M236949</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2021-07-06T13:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752311#M236950</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/210474"&gt;@Mscarboncopy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you. This one still drops the first record. I will see what others suggested. I have another question as I like this better than my "if then statements". My date variable is missing. Do I need to do something else in order to prevent this from happening? I am getting this warning for var A which is date in the code:&amp;nbsp;NOTE: Numeric values have been converted to character values at the places given by...&lt;/P&gt;
&lt;P&gt;Thanks again.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have not shown us your code so we really cannot give anything other than best practice suggestions.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Copy the text from the SAS log for the steps that are not working and paste it into your message using the Insert Code icon (looks like &amp;lt; / &amp;gt; ) to get a pop-up window.&amp;nbsp; Using the Insert Code window will preserve the formatting of the text.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 13:41:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752311#M236950</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-06T13:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752372#M236984</link>
      <description>&lt;P&gt;Understood. I saved the instructions you gave for next time. I was able to find the issue in the previous code thanks to your suggestions. And I learned a more elegant way to do what I was doing with "if then statements", which always helps me with my long codes. However, I am not sure why the dates (var A)&amp;nbsp; are missing when I use the first suggestion though (from Astounding).&amp;nbsp; I added format A mmddyy10 at the beginning but it did not help.&amp;nbsp;This part of the code is straightforward I am doing what Astounding suggested. My dates are formatted as dates in the raw file and the errors for only the date variables are:&amp;nbsp;Numeric values have been converted to character values for the majority and&amp;nbsp;Character values have been converted to numeric values.&amp;nbsp; I wonder if this is an issue with the raw data file? it can't be though because&amp;nbsp;when I use "if then" statements I have no issue. So maybe I should just stick with those ? Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 18:14:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752372#M236984</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2021-07-06T18:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752374#M236986</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/210474"&gt;@Mscarboncopy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Understood. I saved the instructions you gave for next time. I was able to find the issue in the previous code thanks to your suggestions. And I learned a more elegant way to do what I was doing with "if then statements", which always helps me with my long codes. However, I am not sure why the dates (var A)&amp;nbsp; are missing when I use the first suggestion though (from Astounding).&amp;nbsp; I added format A mmddyy10 at the beginning but it did not help.&amp;nbsp; What can I do? Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Context matters.&lt;/P&gt;
&lt;P&gt;Are you talking about this line of code?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;A = coalescec(oldA1, oldA2, oldA3);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If OLDA1 etc are numeric (SAS stores dates a number of days since 1960) instead of character then you will get both the automatic conversion notices and potentially missing values you talk about.&amp;nbsp; Change it to treat the A variables as numbers like it is doing with the B and C variables.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 18:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752374#M236986</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-06T18:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752377#M236988</link>
      <description>&lt;P&gt;Perfect! I will accept his suggestion as solution, keeping in mind that I changed that part.&lt;/P&gt;&lt;P&gt;Thank you so much. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 18:18:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/752377#M236988</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2021-07-06T18:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/753215#M237369</link>
      <description>&lt;P&gt;Is there a similar function I could use to create a variable when the A's are char variables and when more than one can be selected?&amp;nbsp; This is another variable I am working on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I do it this way, it overwrites.&amp;nbsp; VARWANTED = &lt;STRONG&gt;max&lt;/STRONG&gt; (A1, A2, A3); I used &lt;STRONG&gt;coalescec&lt;/STRONG&gt; but it did not work either.&amp;nbsp; "If then statements" give me the same issue.&amp;nbsp; Arrays also don't work.&lt;/P&gt;&lt;P&gt;array _A {*} A: ;&lt;BR /&gt;do VARWANTED =1 to dim(_A);&lt;BR /&gt;if _A{VARWANTED}&amp;gt;0 then output;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Raw Data file looks like .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; A1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A2&amp;nbsp; &amp;nbsp; &amp;nbsp;A3&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;70&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;100&amp;nbsp; &amp;nbsp; &amp;nbsp; 5&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; 16&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 59&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;30&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; 18&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;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if I use the max function:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp;&amp;nbsp;VARWANTED&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 70&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 16&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 18&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I needed to have&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;VARWANTED&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 70&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &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; &amp;nbsp;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 16&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 59&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 30&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 18&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 16:47:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/753215#M237369</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2021-07-09T16:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/753249#M237379</link>
      <description>&lt;P&gt;So you DON"T want to do the same thing as the MAX() function was doing.&lt;/P&gt;
&lt;P&gt;Looks like you want to transpose your multiple variables into multiple observations.&amp;nbsp; PROC TRANSPOSE is designed to let you do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you could also use your ARRAY to do that.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  array _A A: ;
  do VARWANTED =1 to dim(_A);
     if _A[VARWANTED]&amp;gt;0 then do;
       A=_A[VARWANTED];
       output;
    end;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jul 2021 18:16:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/753249#M237379</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-09T18:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dropping first record with if then statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/753543#M237522</link>
      <description>&lt;P&gt;Thank you! The array worked perfectly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 16:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Dropping-first-record-with-if-then-statements/m-p/753543#M237522</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2021-07-12T16:01:09Z</dc:date>
    </item>
  </channel>
</rss>

