<?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: Converting many rows of data into one in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187610#M47587</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hatsie, You answer to optimist is one to think about. Adam datasets &lt;A href="http://www.cdisc.org/adam" title="http://www.cdisc.org/adam"&gt;Analysis Data Model (ADaM) | CDISC&lt;/A&gt; have a well defined structure for some column oriented approaches.&lt;/P&gt;&lt;P&gt;There is lot to find at &lt;A href="http://www.lexjansen.com/" title="http://www.lexjansen.com/"&gt;http://www.lexjansen.com/&lt;/A&gt; for pharma very related to public health. In any case if you want to do something on the US markt you must be aware of the fda.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is a long intro as advice to you forgetting that idea of putting all variables in one record.&lt;/P&gt;&lt;P&gt;Conformance to common approaches and guidelines is more important.&lt;/P&gt;&lt;P&gt;Xia has already started showing something like that to you.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 18 Oct 2014 20:20:24 GMT</pubDate>
    <dc:creator>jakarman</dc:creator>
    <dc:date>2014-10-18T20:20:24Z</dc:date>
    <item>
      <title>Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187590#M47567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, I'm hoping you can help me with my data issue. I have data with tens of thousands of rows per participant (repeated measurements&lt;/P&gt;&lt;P&gt;), and I need to convert it into a single row. I would appreciate any suggestions! I have read the information on transposing, but that's not quite what I want to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A data file for one participant is in a format like this (but obviously has many more rows):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Time VariableA VariableB VariableC&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I need to convert it to a format like this, retaining the timestamp for each set of measurements as its own variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Time1 VariableA1 VariableB1 VariableC1&amp;nbsp; Time2 VariableA2 VariableB2 VariableC2&amp;nbsp; Time3 VariableA3 VariableB3 VariableC3&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have many files like this, and want to eventually end up with a single file that has one row per participant.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 15:05:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187590#M47567</guid>
      <dc:creator>Hatsie</dc:creator>
      <dc:date>2014-10-16T15:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187591#M47568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This SAS macro has helped me achieved what you want to do.&amp;nbsp; One caveat is to have a unique identifier for each participant and transpose by that variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.medicine.mcgill.ca/epidemiology/joseph/pbelisle/multitranspose.html" title="http://www.medicine.mcgill.ca/epidemiology/joseph/pbelisle/multitranspose.html"&gt;SAS macro %MultiTranspose: Transposing multiple variables in a SAS data set within a single macro call&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 15:16:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187591#M47568</guid>
      <dc:creator>kewong</dc:creator>
      <dc:date>2014-10-16T15:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187592#M47569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My first question would be why?&amp;nbsp; You will end up with a lot of variables and few rows which probably isn't the best for processing or further work.&amp;nbsp; What is it your trying to achieve as there may be better ways of getting the outcome.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 15:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187592#M47569</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-10-16T15:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187593#M47570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Re: kewong. Thank you, I will try this out. This may be a silly question, but where do I put that line of %multtransponse? Does it go within a data statement? &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;And what about the huge amount of code that is at the bottom of the website you linked to... do I need all of that, or just the one line?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;Re: RW9, I need to sum the observations across time variables. If it helps, what I'm working with is physical activity data collected over an entire week. Each 15-second interval is its own row. So I need to create a summary variable for each day that adds up all of the physical activity. But also will need to mark and pull out the hours of the day when the person was sleeping (they were still wearing the monitor 24 hrs/day, even when asleep, so there are data from when they are rolling around in bed, etc., which I need to remove).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 15:49:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187593#M47570</guid>
      <dc:creator>Hatsie</dc:creator>
      <dc:date>2014-10-16T15:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187594#M47571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I think you probably can achieve the data structure you want by transposing - that's where I'd be focusing my efforts.&amp;nbsp; You'll need to do multiple transpositions into new datasets - one for each variable or variable, timestamp combination, AND you'll need something as a unique key to merge datasets back together - perhaps a concatenated field.&amp;nbsp; Once you've transposed all the variables you'll need to join or merge the wide datasets back together to get one dataset - that's where you'll be glad you when through the effort to create a key.&amp;nbsp; See the link below for step-by-step details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.ats.ucla.edu/stat/sas/modules/ltow_transpose.htm"&gt;http://www.ats.ucla.edu/stat/sas/modules/ltow_transpose.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 15:51:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187594#M47571</guid>
      <dc:creator>bootstrap_armada</dc:creator>
      <dc:date>2014-10-16T15:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187595#M47572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The sample data shows a perfectly normal transpose. Is there something else that makes it different?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 16:01:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187595#M47572</guid>
      <dc:creator>RickAster</dc:creator>
      <dc:date>2014-10-16T16:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187596#M47573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think that may be my error in understanding the term. Sometimes in Excel I use the transpose feature, which switches columns and rows. So I assumed that proc transpose would reverse columns and rows, not turn multiple rows into a single row...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 16:03:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187596#M47573</guid>
      <dc:creator>Hatsie</dc:creator>
      <dc:date>2014-10-16T16:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187597#M47574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I actually agree with mr. boostrap. &lt;/P&gt;&lt;P&gt;you can basically use proc transpose, but you need a unique key say "Account" to eventually merge all columns. Change in new variable names can be achieved by a macro fairly easily.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 16:04:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187597#M47574</guid>
      <dc:creator>Julian1</dc:creator>
      <dc:date>2014-10-16T16:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187598#M47575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you everyone who has responded so far. This is my first time trying the forum so I didn't know whether anyone would chime in. I really appreciate this help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, in re: Bootstrap_armada, I read the example you sent. That example seems a bit more straightforward because each family has data for the same three years: 96, 97, and 98. So they specify "id=year" and the new columns are labeled accordingly But will that still work for my example, when the values for the "time" variable are different for everyone? (Everyone started wearing their monitor on a different date)?&amp;nbsp; I need mine not to append the column name with a value, but basically just say "time1 time2 time3 time4" etc. because "time1" is different for every person.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;** Edited to add that other than that bit, the page you sent is very helpful and I was able to understand what they're doing... so it seems promising... it's just the "id" piece I'm unsure about.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 16:11:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187598#M47575</guid>
      <dc:creator>Hatsie</dc:creator>
      <dc:date>2014-10-16T16:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187599#M47576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if i understand correctly, you can sort by time, then use a first. function to create a count, then you have 1,2,3,4. by string function here you go, time1 time2 time3 time4...etc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.ats.ucla.edu/stat/sas/faq/enumerate.htm"&gt;http://www.ats.ucla.edu/stat/sas/faq/enumerate.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 16:27:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187599#M47576</guid>
      <dc:creator>Julian1</dc:creator>
      <dc:date>2014-10-16T16:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187600#M47577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you might be better off creating a group variable from time. Since your "time" is obviously not time but occurrence if you describe the relation to the desired totals needed I'll bet we can do this with your existing data and proc means/summary.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 16:31:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187600#M47577</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-10-16T16:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187601#M47578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ballard, I edited the original post to add one of my actual datasets in case that is helpful to anyone. I think I understand what you are saying about the time variable... if I understand correctly, you are suggesting that we could just enumerate the occurences. Since everyone has 1 week of data from their physical activity sensor ( ~40,320 15-second intervals of data), we could just number those 40,320 occurences, right, rather than labeling them by the actual date/time of the occurence?&amp;nbsp; The rub is that I need to remove blocks of data... so if someone slept from 11:21 pm - 6:07 a.m. between the first and second day, I need to be able to identify and delete all the rows that pertain to those dates and times.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 16:44:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187601#M47578</guid>
      <dc:creator>Hatsie</dc:creator>
      <dc:date>2014-10-16T16:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187602#M47579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So, I ran a single-variable PROC TRANSPOSE, which seems to have worked fine. The log said I have 1 observation and 40,320 variables, so that sounds good to me. But I can't really take a look at the data, because when I run PROC CONTENTS, SAS gets all gummed up and stops responding. Is this normal with huge datasets? How do you work with it if you can't look at it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 16:50:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187602#M47579</guid>
      <dc:creator>Hatsie</dc:creator>
      <dc:date>2014-10-16T16:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187603#M47580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the kind of problem you can run into, not with large data sets, but with such a large number of variables. It explains why commenters are so reluctant to create so many variables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 16:56:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187603#M47580</guid>
      <dc:creator>RickAster</dc:creator>
      <dc:date>2014-10-16T16:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187604#M47581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So your really going to try working with a dataset which has 40320 variables?&amp;nbsp; Best of luck with that.&amp;nbsp; Me personally I would get your data looking like (normalised):&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Time VariableName&amp;nbsp; VariableResult&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use grouped functions, e.g for SQL:&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table SUMS as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; distinct TIME,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(VARIABLE_RESULT) as SUM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATASET&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by TIME;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you could provide actual test data and required output I could have a look at it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 17:02:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187604#M47581</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-10-16T17:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187605#M47582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hastie,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could I ask what sort of analysis or report you plan on running with the resultant dataset? As others have commented, 40,320 variable is a lot of variables. If you will be doing additional analysis what statistical/analytical application (SAS, Stata, SPSS, R, etc.)&amp;nbsp; and which procedure or routine do you plan on using?&amp;nbsp; If you are preparing a report, what tool do you intend to use (Excel, Crystal Reports, SQL Server, etc.)&amp;nbsp; Someone here might be able to suggest a more efficient way to organize the data.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 17:09:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187605#M47582</guid>
      <dc:creator>optimist</dc:creator>
      <dc:date>2014-10-16T17:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187606#M47583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure. So, I have 7 days of data per person, collected 24 hrs/day in 15-sec intervals, and as the data are organized currently, each 15-second interval is its own row. Eventually I would to have like a dataset that looks like this, where I have already removed all of the data for the chunks of time when I know (based on separate logs) that each person was sleeping.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Participant&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WearDay1&amp;nbsp;&amp;nbsp; SittingHrs1&amp;nbsp;&amp;nbsp; StandHrs1&amp;nbsp;&amp;nbsp; SteppingHrs1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SitStandTransitions1&amp;nbsp;&amp;nbsp;&amp;nbsp; Steps1&amp;nbsp;&amp;nbsp;&amp;nbsp; WearDay2&amp;nbsp;&amp;nbsp;&amp;nbsp; SittingHrs2&amp;nbsp; StandHrs2...&lt;/P&gt;&lt;P&gt;Guy Smiley&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3/4/2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9.1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 41&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5596&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3/5/2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9.6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.1&lt;/P&gt;&lt;P&gt;Kermit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11/21/2013&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8.6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4.1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 68&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7637&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11/22/2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8.8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3.2&lt;/P&gt;&lt;P&gt;PrairieDawn&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/9/2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9.9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 32&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2974&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5/10/2014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8.7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I would&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; create overall variables for each person's week, so that I know the average hrs/day each person spends sitting down, standing up, and stepping, as well as the average number of steps/day they take, and the average number of sit-to-stand transitions they make.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;*** EDited this to fix a couple of variable names.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 17:24:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187606#M47583</guid>
      <dc:creator>Hatsie</dc:creator>
      <dc:date>2014-10-16T17:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187607#M47584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And, Optimist, to answer the rest of your question, I am planning to do the rest of the analysis in SAS. I work in public health and this is data from a pilot study we did looking at lifestyle patterns in a specific disease group....&amp;nbsp; the eventual goal is to quantify/describe how they are spending their time, and determine whether those who are spending more time sitting have higher levels of certain biomarkers in the blood.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 17:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187607#M47584</guid>
      <dc:creator>Hatsie</dc:creator>
      <dc:date>2014-10-16T17:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187608#M47585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suspect you're just making it hard for yourself by converting rows to columns, both in your initial steps and in your eventual requirement. In terms of the latter, what does having all days on a single row give you that one row per day would not? A simple PROC SUMMARY would allow you to roll together days of data if that's what's ultimately required. If it's the kind of project I think it is, then there will be further questions and analyses that spring from the results of this stage, and the simpler your data structure is, the easier it's going to be to perform those analyses. Keep everything in simple non-repeating columns as far as you possibly can, and I think you can probably achieve that using simple DATA steps, PROC SORTs and PROC SUMMARYs. Transpose for reporting at the end if you must, but keep your data simple as possible as long as possible. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 19:01:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187608#M47585</guid>
      <dc:creator>SpiggyTopes</dc:creator>
      <dc:date>2014-10-17T19:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Converting many rows of data into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187609#M47586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The simplest way is using proc means + idgroup. But you need to reorder variables . The second way is you don't need to reorder them .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
input id Time VariableA VariableB VariableC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;;
cards;
1 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9
1 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11
1 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5
2 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9
2 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11
2 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9
2 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11
;
run;

/*** First way&amp;nbsp; Need reorder variables***/
proc sql noprint;
select max(n) into : n from (select count(*)as n from have group by id);
quit;
%put &amp;amp;n;
proc summary data=have;
by id;
output out=want(drop=_:) idgroup(out[&amp;amp;n] (Time VariableA VariableB VariableC) = );
run;

/** Second way No need reorder variables**/
proc sort data=have(keep=time) out=temp nodupkey;by time;run;
data _null_;
 set temp end=last;
 if _n_ eq 1 then call execute('data want1;merge ');
 call execute(catt('have(where=(time_',time,'=',time,') rename=(Time=Time_',time,' VariableA=VariableA_',time,' VariableC=VariableC_',time,'))'));
 if last then call execute(';by id;run;');
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Oct 2014 14:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Converting-many-rows-of-data-into-one/m-p/187609#M47586</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-10-18T14:21:32Z</dc:date>
    </item>
  </channel>
</rss>

