<?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: Repeating records in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Repeating-records/m-p/47225#M12648</link>
    <description>Thanks Daniel. This works.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Matt</description>
    <pubDate>Tue, 26 Jan 2010 18:31:00 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-01-26T18:31:00Z</dc:date>
    <item>
      <title>Repeating records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Repeating-records/m-p/47222#M12645</link>
      <description>Hi ,&lt;BR /&gt;
I have a dataset with records like&lt;BR /&gt;
&lt;BR /&gt;
ID  VI   Var1  Var2  Var3&lt;BR /&gt;
1    1      .       23      .&lt;BR /&gt;
1    1      21      .       .&lt;BR /&gt;
1    1      .         .       24 &lt;BR /&gt;
&lt;BR /&gt;
I want this to be in one row something like&lt;BR /&gt;
&lt;BR /&gt;
ID   VI    Var1   Var2  Var3&lt;BR /&gt;
1     1       21      23     24&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Any suggestion on how to make this possible?&lt;BR /&gt;
&lt;BR /&gt;
Appreciate your time and help.&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
Matt</description>
      <pubDate>Tue, 26 Jan 2010 16:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Repeating-records/m-p/47222#M12645</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-26T16:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Repeating records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Repeating-records/m-p/47223#M12646</link>
      <description>Hi.&lt;BR /&gt;
&lt;BR /&gt;
Assuming, VAR1, VAR2, VAR3 are numeric and will hold only one value per group being the other equal to MISSING value (.), you could output a single obs for each group, retaining the values of VAR1, VAR2, VAR3.&lt;BR /&gt;
&lt;BR /&gt;
Something like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data OUTDATA;&lt;BR /&gt;
set INDATA (rename = (VAR1=_VAR1 VAR2=_VAR2 VAR3=_VAR3))&lt;BR /&gt;
by ID V1;&lt;BR /&gt;
retain VAR1 VAR2 VAR3 .; * retain new variables;&lt;BR /&gt;
drop _:; * drop old variables;&lt;BR /&gt;
VAR1=MAX(VAR1,_VAR1); VAR2=MAX(VAR2,_VAR2); VAR3=MAX(VAR3,_VAR3);&lt;BR /&gt;
if last.VI; * output last obs of group;&lt;BR /&gt;
output;&lt;BR /&gt;
VAR1=.; VAR2=.; VAR3=.; * reinit;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Or&lt;BR /&gt;
&lt;BR /&gt;
Simply group data and calculate max for VAR1, VAR2, VAR3,&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
create table OUTDATA as&lt;BR /&gt;
select ID, VI, max(VAR1) as VAR1, max(VAR2) as VAR2, max(VAR3) as VAR3 from INDATA group bt ID, VI;&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Or.&lt;BR /&gt;
&lt;BR /&gt;
Transpose the table through PROC TRANSPOSE.&lt;BR /&gt;
&lt;BR /&gt;
Code above was not tested.&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Tue, 26 Jan 2010 17:53:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Repeating-records/m-p/47223#M12646</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2010-01-26T17:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Repeating records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Repeating-records/m-p/47224#M12647</link>
      <description>It appears you want to collapse your input data file to eliminate "presumed" missing conditions for candidate observations.&lt;BR /&gt;
&lt;BR /&gt;
Possibly PROC TRANSPOSE or PROC SUMMARY (but that will depend more about the input data and how you want to process it.  Or a SAS DATA step offers you the most flexibility.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 26 Jan 2010 17:55:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Repeating-records/m-p/47224#M12647</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-26T17:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: Repeating records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Repeating-records/m-p/47225#M12648</link>
      <description>Thanks Daniel. This works.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Matt</description>
      <pubDate>Tue, 26 Jan 2010 18:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Repeating-records/m-p/47225#M12648</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-26T18:31:00Z</dc:date>
    </item>
  </channel>
</rss>

