<?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: From short to long format for SDTM programming in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/From-short-to-long-format-for-SDTM-programming/m-p/981767#M43615</link>
    <description>&lt;P&gt;You need a combination of variables that uniquely identify the observations to use PROC TRANSPOSE.&amp;nbsp; You could always just run an extra data step to create one first.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data DB;
  input (ID Start End TypeTransfusion1-TypeTransfusion3) (:$20.); 
cards;
0001 2024-09-01 2024-10-01  RBC  Whole blood     .    
0001 2024-09-01 2024-10-01   .        .       Platelet
0002 2016-NK-NK 2016-NK-NK   .    Whole blood Platelet
0002 2016-05-02 2016-05-02  RBC Whole blood      .      
0002 2016-05-05 2016-05-04   .        .       Platelet
0003    .            .       .        .          .    
0003    .            .       .        .          .   
0004 2024-09-01 2024-10-01 RBC Whole blood       .   
0004 2024-09-01 2024-10-01  .         .       Platelet
0005 2025-11-03 2025-11-23  .   Whole blood      .     
0005 2025-11-03 2025-11-14 RBC       .           .  
; 

data for_transpose;
  row+1;
  set db;
run;

proc transpose data=for_transpose out=want(rename=(col1=TypeTransfusion));
  by row id start end;
  var TypeTransfusion1-TypeTransfusion3;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or just don't bother with using PROC TRANSPOSE and instead just write the data step to transpose the data yourself.&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;You might want to add logic to eliminate the empty values.&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jan 2026 16:54:30 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2026-01-09T16:54:30Z</dc:date>
    <item>
      <title>From short to long format for SDTM programming</title>
      <link>https://communities.sas.com/t5/New-SAS-User/From-short-to-long-format-for-SDTM-programming/m-p/981762#M43614</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;suppose to have the following table (I received as it is):&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.; 
cards;
0001 2024-09-01 2024-10-01  RBC  Whole blood     .    
0001 2024-09-01 2024-10-01   .        .       Platelet
0002 2016-NK-NK 2016-NK-NK   .    Whole blood Platelet
0002 2016-05-02 2016-05-02  RBC Whole blood      .      
0002 2016-05-05 2016-05-04   .        .       Platelet
0003    .            .       .        .          .    
0003    .            .       .        .          .   
0004 2024-09-01 2024-10-01 RBC Whole blood       .   
0004 2024-09-01 2024-10-01  .         .       Platelet
0005 2025-11-03 2025-11-23  .   Whole blood      .     
0005 2025-11-03 2025-11-14 RBC       .           .  
; 
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I need to transform it in long format to be compliant with PR programming of SDTM (CDISC).&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;I used proc transpose on each of TypeTransfusion* variable (to finally merge the outputs) but without success because for each ID the output is splitted by columns to account for the procedure at different time points (dates).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2026 14:18:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/From-short-to-long-format-for-SDTM-programming/m-p/981762#M43614</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2026-01-09T14:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: From short to long format for SDTM programming</title>
      <link>https://communities.sas.com/t5/New-SAS-User/From-short-to-long-format-for-SDTM-programming/m-p/981767#M43615</link>
      <description>&lt;P&gt;You need a combination of variables that uniquely identify the observations to use PROC TRANSPOSE.&amp;nbsp; You could always just run an extra data step to create one first.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data DB;
  input (ID Start End TypeTransfusion1-TypeTransfusion3) (:$20.); 
cards;
0001 2024-09-01 2024-10-01  RBC  Whole blood     .    
0001 2024-09-01 2024-10-01   .        .       Platelet
0002 2016-NK-NK 2016-NK-NK   .    Whole blood Platelet
0002 2016-05-02 2016-05-02  RBC Whole blood      .      
0002 2016-05-05 2016-05-04   .        .       Platelet
0003    .            .       .        .          .    
0003    .            .       .        .          .   
0004 2024-09-01 2024-10-01 RBC Whole blood       .   
0004 2024-09-01 2024-10-01  .         .       Platelet
0005 2025-11-03 2025-11-23  .   Whole blood      .     
0005 2025-11-03 2025-11-14 RBC       .           .  
; 

data for_transpose;
  row+1;
  set db;
run;

proc transpose data=for_transpose out=want(rename=(col1=TypeTransfusion));
  by row id start end;
  var TypeTransfusion1-TypeTransfusion3;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or just don't bother with using PROC TRANSPOSE and instead just write the data step to transpose the data yourself.&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;You might want to add logic to eliminate the empty values.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2026 16:54:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/From-short-to-long-format-for-SDTM-programming/m-p/981767#M43615</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-01-09T16:54:30Z</dc:date>
    </item>
  </channel>
</rss>

