<?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: Combine the coding on arrays in the same data step in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982173#M43626</link>
    <description>&lt;P&gt;Can you see why that did not work?&lt;/P&gt;
&lt;P&gt;Do you see the pattern that will emerge in the output?&lt;/P&gt;
&lt;P&gt;Hint:&lt;/P&gt;
&lt;LI-SPOILER&gt;Check how many OUTPUT statements the data step executes on each input observation.&lt;BR /&gt;&lt;BR /&gt;Think about what values the variables will have when the OUTPUT statements execute.&lt;/LI-SPOILER&gt;</description>
    <pubDate>Mon, 19 Jan 2026 18:52:51 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2026-01-19T18:52:51Z</dc:date>
    <item>
      <title>Combine the coding on arrays in the same data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982159#M43621</link>
      <description>&lt;P&gt;Dear all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;suppose to have the following dataset:&amp;nbsp;&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 DB;
  input ID :$20. Start :$20. End :$20. TypeTransfusion1 :$20. TypeTransfusion2 :$20. TypeTransfusion3 :$20. Result1 :$20. Result2 :$20. Result3 :$20.; 
cards;
0001 2024-09-01 2024-10-01  RBC  Whole blood     .         Positive    Positive        .
0001 2024-09-01 2024-10-01   .        .       Platelet        .             .   Negative
0002 2016-NK-NK 2016-NK-NK   .    Whole blood Platelet        .        Negative Positive 
0002 2016-05-02 2016-05-02  RBC Whole blood      .         Positive    Positive        .
0002 2016-05-05 2016-05-04   .        .       Platelet         .          .      Negative
0003    .            .       .        .          .             .          .            .
0003    .            .       .        .          .             .          .            .
0004 2024-09-01 2024-10-01 RBC Whole blood       .         Negative    Positive        .
0004 2024-09-01 2024-10-01  .         .       Platelet         .          .      Positive
0005 2025-11-03 2025-11-23  .   Whole blood      .             .    Positive        . 
0005 2025-11-03 2025-11-14 RBC       .           .         Negative       .            .
; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In one of my previous posts named: "From short to long format for SDTM programming," I asked for support to transpose the dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Gently the following help was provided to me:&amp;nbsp;&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 want2;
  set db;
  length TypeTransfusion $20;
  array list TypeTransfusion1-TypeTransfusion3 ;
  do index=1 to dim(list);
    TypeTransfusion=list[index];
    output;
  end;
  drop TypeTransfusion1-TypeTransfusion3;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The initial dataset contained only the "TypeTransfusion*" variable. Now, another variable "Result*" has been added. How can I integrate this new variable into the code above? In other words, I need to do the same thing that I do for the TypeTransfusion variable also for the Result variable in the same piece of code above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help me please?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jan 2026 16:27:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982159#M43621</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2026-01-19T16:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the coding on arrays in the same data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982165#M43624</link>
      <description>&lt;P&gt;What did you try?&amp;nbsp; How did it go?&amp;nbsp; Did you get any errors in the log?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You just need to add two statements and modify one other.&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want2;
  set db;
  length TypeTransfusion $20;
  array list TypeTransfusion1-TypeTransfusion3 ;
  array list2 Result1-Result3;
  do index=1 to dim(list);
    TypeTransfusion=list[index];
    Result=list2[index];
    output;
  end;
  drop TypeTransfusion1-TypeTransfusion3 Result1-Result3;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jan 2026 16:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982165#M43624</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-01-19T16:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the coding on arrays in the same data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982168#M43625</link>
      <description>I naively tried the following: &lt;BR /&gt;&lt;BR /&gt;data want2;&lt;BR /&gt;  set db;&lt;BR /&gt;  length TypeTransfusion Res $20;&lt;BR /&gt;  array list TypeTransfusion1-TypeTransfusion3 ;&lt;BR /&gt;  do index=1 to dim(list);&lt;BR /&gt;    TypeTransfusion=list[index];&lt;BR /&gt;    output;&lt;BR /&gt;  end;&lt;BR /&gt;  drop TypeTransfusion1-TypeTransfusion3;&lt;BR /&gt;&lt;BR /&gt; array list1 Result1-Result3 ;&lt;BR /&gt;  do index=1 to dim(list1);&lt;BR /&gt;    Res=list[index];&lt;BR /&gt;    output;&lt;BR /&gt;  end;&lt;BR /&gt;  drop  Result1-Result3;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;There is no error, but it doesn't do the job</description>
      <pubDate>Mon, 19 Jan 2026 16:58:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982168#M43625</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2026-01-19T16:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the coding on arrays in the same data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982173#M43626</link>
      <description>&lt;P&gt;Can you see why that did not work?&lt;/P&gt;
&lt;P&gt;Do you see the pattern that will emerge in the output?&lt;/P&gt;
&lt;P&gt;Hint:&lt;/P&gt;
&lt;LI-SPOILER&gt;Check how many OUTPUT statements the data step executes on each input observation.&lt;BR /&gt;&lt;BR /&gt;Think about what values the variables will have when the OUTPUT statements execute.&lt;/LI-SPOILER&gt;</description>
      <pubDate>Mon, 19 Jan 2026 18:52:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982173#M43626</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-01-19T18:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the coding on arrays in the same data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982176#M43627</link>
      <description>&lt;P&gt;Best would be to show an example of the expected result for your "transpose" of the example data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that "doesn't do the job" does not provide any detail about what was missing (or extra) or what is actually wrong with the resulting data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A likely incomplete guess on my part as to part of the objection about the output data set would be the repeated values of the last TypeTransfusion but I am sure that is not the only bit.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jan 2026 22:45:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982176#M43627</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2026-01-19T22:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the coding on arrays in the same data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982179#M43628</link>
      <description>You only need one DO loop.</description>
      <pubDate>Tue, 20 Jan 2026 00:57:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982179#M43628</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2026-01-20T00:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the coding on arrays in the same data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982258#M43629</link>
      <description>Could you please give me an example? Thank you very much!</description>
      <pubDate>Wed, 21 Jan 2026 10:00:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982258#M43629</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2026-01-21T10:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the coding on arrays in the same data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982261#M43630</link>
      <description>&lt;P&gt;Try the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want2;
  set db;
  length TypeTransfusion result $20;
  array list TypeTransfusion1-TypeTransfusion3 ;
  array list_r result1-result3;
  do index=1 to dim(list);
    TypeTransfusion=list[index];
	result=list_r[index];
    output;
  end;
  drop TypeTransfusion1-TypeTransfusion3 result1-result3;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Jan 2026 12:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982261#M43630</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2026-01-21T12:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the coding on arrays in the same data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982265#M43631</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134532"&gt;@NewUsrStat&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Could you please give me an example? Thank you very much!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please note Tom's first answer.&amp;nbsp; He already provided a full example, almost identical to Kathryn's.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jan 2026 13:22:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-the-coding-on-arrays-in-the-same-data-step/m-p/982265#M43631</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2026-01-21T13:22:51Z</dc:date>
    </item>
  </channel>
</rss>

