<?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: Using arrays in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806911#M318009</link>
    <description>Thanks a lot, i tested your code and it works well!!&lt;BR /&gt;Have a nice day</description>
    <pubDate>Sat, 09 Apr 2022 07:36:58 GMT</pubDate>
    <dc:creator>Romain69100</dc:creator>
    <dc:date>2022-04-09T07:36:58Z</dc:date>
    <item>
      <title>Using arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806600#M317829</link>
      <description>Hi sas users!&lt;BR /&gt;&lt;BR /&gt;I am new to SAS and i am looking for help.&lt;BR /&gt;I have a dataset in wide format. Patients are followed for 20 days and each day i have tiredness measurement (20 variable per patient(day_1, day_2 ect..) and tiredness is a score between 0 and 100). I have a binary indicator (status)which is equal to 1 if tiredness is greater or equal to 80 and 0 otherwise. Using an array i would like to create a time to event variable which will take the value of the number of day when patient FIRST got a tiredness score greater or equal to 80 for those who have status=1 and the LAST number of day available in the follow up for those who have status=0.&lt;BR /&gt;&lt;BR /&gt;Do you have sas script that can do it?&lt;BR /&gt;Thanks for your help&lt;BR /&gt;&lt;BR /&gt;Romain&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Apr 2022 17:55:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806600#M317829</guid>
      <dc:creator>Romain69100</dc:creator>
      <dc:date>2022-04-07T17:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806603#M317832</link>
      <description>&lt;P&gt;If I am understanding properly, then no array needed. You don't specifically state if you have 20 status variables, such as status1 status2 &lt;EM&gt;etc&lt;/EM&gt;. but assuming you do have this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;time_to_event = whichn(1,of status1-status20);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 18:33:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806603#M317832</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-07T18:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806607#M317835</link>
      <description>Thank you PaigeMiller for your reply. I have only one status variable. But i have 20 variable day_1, day_2 .... day_20 recording the tiredness score (one row per patient). Let say first patient have a tiredness score greater than 80 at day 4 so time to event will be equal to 4 for this subject. If the patient, during the 20 visits, do not reach a score greater to 80 , the time to event will correspond to the last day of follow up.&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Apr 2022 18:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806607#M317835</guid>
      <dc:creator>Romain69100</dc:creator>
      <dc:date>2022-04-07T18:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806609#M317837</link>
      <description>&lt;P&gt;Okay so your description to me is contradictory and not making sense. You said earlier "&lt;SPAN&gt;I have a binary indicator (status)which is equal to 1 if tiredness is greater or equal to 80 and 0 otherwise." Wouldn't there be 20 of these? But now you say the first occurrence&amp;nbsp;of 80 is in day 4 but don't mention the status variable at all.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The best thing to do is to show us a small portion of the data, following &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;, or type in SAS data step code by yourself — and not via any other method. You can, if you want, assume there are only 5 time periods, we just need to see the layout of the data.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 18:49:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806609#M317837</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-07T18:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806621#M317843</link>
      <description>&lt;P&gt;Sorry&amp;nbsp; for my english and if i am not clear (English is not my mother tongue).&lt;/P&gt;&lt;P&gt;Please find attached the file below.&lt;/P&gt;&lt;P&gt;I want to create the time to status variable as it appear in the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 19:08:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806621#M317843</guid>
      <dc:creator>Romain69100</dc:creator>
      <dc:date>2022-04-07T19:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806623#M317844</link>
      <description>&lt;P&gt;I realize you are new here, but I specifically stated the format needed, and that other formats are not acceptable. Many of us (including me) will not download attachments. Please show us SAS data step code that will reproduce a portion of your data set.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 19:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806623#M317844</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-07T19:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806637#M317847</link>
      <description>&lt;P&gt;Here is the data step to create the table:&lt;/P&gt;&lt;P&gt;data tiredness;&lt;/P&gt;&lt;P&gt;input ID $ Day_1 Day_2 Day_3 Day_4 Day_5 status;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 50 60 70 85 20 1&lt;/P&gt;&lt;P&gt;2 10 20 30&amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; .&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;3 20 40 50 55 60 0&lt;/P&gt;&lt;P&gt;4 85 79 100 120 130 1&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a new variable time_to_status which will take the following values:&lt;/P&gt;&lt;P&gt;4 , 3, 5,1 for individus 1,2,3,4 respectively.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 19:30:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806637#M317847</guid>
      <dc:creator>Romain69100</dc:creator>
      <dc:date>2022-04-07T19:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806640#M317848</link>
      <description>&lt;P&gt;Great! Thank you.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set tiredness;
    array d day_1-day_5;
    do i=1 to dim(d);
        if d(i)&amp;gt;=80 then do;
            time_to_event=i;
            leave;
        end;
        if time_to_event=. then time_to_event=n(of d(*));
    end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 19:34:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806640#M317848</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-07T19:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806642#M317850</link>
      <description>&lt;P&gt;Thank you for your quick reply :).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am at home for the moment (France) so i will test it tomorrow.&lt;/P&gt;&lt;P&gt;For individuals with non missing missing values and and status=0 does the code will increment for time_to_status the last day of follow up?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 19:42:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806642#M317850</guid>
      <dc:creator>Romain69100</dc:creator>
      <dc:date>2022-04-07T19:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806663#M317856</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/422284"&gt;@Romain69100&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for your quick reply :).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am at home for the moment (France) so i will test it tomorrow.&lt;/P&gt;
&lt;P&gt;For individuals with non missing missing values and and status=0 does the code will increment for time_to_status the last day of follow up?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It does this: "I want to create a new variable time_to_status which will take the following values: 4 , 3, 5,1 for individus 1,2,3,4 respectively."&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 21:30:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806663#M317856</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-07T21:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806911#M318009</link>
      <description>Thanks a lot, i tested your code and it works well!!&lt;BR /&gt;Have a nice day</description>
      <pubDate>Sat, 09 Apr 2022 07:36:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806911#M318009</guid>
      <dc:creator>Romain69100</dc:creator>
      <dc:date>2022-04-09T07:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Using arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806916#M318012</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/422284"&gt;@Romain69100&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Great. Please mark the reply with the working code as correct, instead of marking the reply with a brief comment as correct.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Apr 2022 10:09:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-arrays/m-p/806916#M318012</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-09T10:09:42Z</dc:date>
    </item>
  </channel>
</rss>

