<?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: first second third values with missing value in a row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/first-second-third-values-with-missing-value-in-a-row/m-p/818848#M323242</link>
    <description>&lt;P&gt;Figure out where to start. Then copy.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  input id $ have1-have4;
cards;
a   201604 .      .      201901       
b   .      201708 201811 .         
c   .      .      .      201911    
d   .      .      .      .
;

data want;
 set have ;
 array old have1-have4;
 array new want1-want4;
 do start=1 to dim(old) until (not missing(old[start])); end;
 target=1;
 do index=start to dim(old);
   new[target]=old[index];
   target+1;
 end;
 drop index target;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 17 Jun 2022 15:40:19 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-06-17T15:40:19Z</dc:date>
    <item>
      <title>first second third values with missing value in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-second-third-values-with-missing-value-in-a-row/m-p/818845#M323240</link>
      <description>&lt;P&gt;Hi SAS experts,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need your advice regarding above situation.&lt;/P&gt;&lt;P&gt;I would like to have variables: expect1, expect2, expect3, expect4 by using y_2016, y_2017, y_2018, y_2019 variables.&lt;/P&gt;&lt;P&gt;For expect1 variables, I use coalesce to get this index date. Something like below.&lt;/P&gt;&lt;P&gt;expect1= coalesce(y_2016, y_2017, y_2018, y_2019) ;&lt;/P&gt;&lt;P&gt;but I would like to keep the missing values if there is no information.&lt;/P&gt;&lt;P&gt;(I would like to keep missing values in the row)&lt;/P&gt;&lt;P&gt;In this case, each row represent one patient dates.&lt;/P&gt;&lt;P&gt;Goal is to have t, t+1, t+2, t+3, t+4 information.&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;&lt;PRE&gt;data have ;
  input id y_2016 y_2017 y_2018  y_2019    expect1 expect2 expect3 expect4;
  CARDS;

a   201604  .     .         201901          201604      .        .     201901 
b   .         201708   201811 .             201708    201811     .      .
c    .         .        .     201911        201911      .        .      .
;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jun 2022 15:26:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-second-third-values-with-missing-value-in-a-row/m-p/818845#M323240</guid>
      <dc:creator>chimei0403</dc:creator>
      <dc:date>2022-06-17T15:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: first second third values with missing value in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-second-third-values-with-missing-value-in-a-row/m-p/818848#M323242</link>
      <description>&lt;P&gt;Figure out where to start. Then copy.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  input id $ have1-have4;
cards;
a   201604 .      .      201901       
b   .      201708 201811 .         
c   .      .      .      201911    
d   .      .      .      .
;

data want;
 set have ;
 array old have1-have4;
 array new want1-want4;
 do start=1 to dim(old) until (not missing(old[start])); end;
 target=1;
 do index=start to dim(old);
   new[target]=old[index];
   target+1;
 end;
 drop index target;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jun 2022 15:40:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-second-third-values-with-missing-value-in-a-row/m-p/818848#M323242</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-17T15:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: first second third values with missing value in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-second-third-values-with-missing-value-in-a-row/m-p/818871#M323250</link>
      <description>Thank you so much Tom! You are amazing!!</description>
      <pubDate>Fri, 17 Jun 2022 17:15:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-second-third-values-with-missing-value-in-a-row/m-p/818871#M323250</guid>
      <dc:creator>chimei0403</dc:creator>
      <dc:date>2022-06-17T17:15:45Z</dc:date>
    </item>
  </channel>
</rss>

