<?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: Moving values row up in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Moving-values-row-up/m-p/445335#M111575</link>
    <description>&lt;P&gt;The way you posted the data is &lt;STRONG&gt;very&lt;/STRONG&gt; hard to read and the result is not very clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The best way to post data is to use a data step so others have data to actually manipulate. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best is to actually post the result for a given example data set.&lt;/P&gt;
&lt;P&gt;I am not sure if you want a data set or report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Mar 2018 21:52:50 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-03-13T21:52:50Z</dc:date>
    <item>
      <title>Moving values row up</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Moving-values-row-up/m-p/445291#M111563</link>
      <description>&lt;DIV class="lia-message-heading lia-component-message-header"&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-standard"&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-20 lia-quilt-column-left"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-left"&gt;&lt;DIV class="lia-message-subject"&gt;&amp;nbsp;&lt;DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;Dear colleagues,&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;I need to transform a table so I have one row by ID variable. My present database is like that:&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;ID X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 Xn&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;1 90 . . . . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;1 . 91 . . . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;1 . . 03 . . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;2 98 . . . . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;3 94 . . . . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;3 . 95 . . . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;3 . . 00 . . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;3 . . . 00 . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;4 07 . . . . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;4 . 08 . . . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;4 . . 08 . . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;4 . . . 08 . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;4 . . . . 10 . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;My highest value "n" ends in 20 for Xn. Some individuals will face just 1 event, others will face 20 events. ID has more than 10,000 values. X is the year of event variable.&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;As you can see for ID 3 and 4, individuals can live two different events at the same year.&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;I want to create this table:&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;ID X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 Xn&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;1 90&amp;nbsp; 91&amp;nbsp; 03 . . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;2 98 . . . . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;3 94 95 00 00 . . . . . . .&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;4 07 08 08 08 10 . . . . . .&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;I want to create a one row by individual.&amp;nbsp;I have searched for this information in the forums, but I did not find anything. Can anybody help me? Many thanks in advance.&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 13 Mar 2018 20:22:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Moving-values-row-up/m-p/445291#M111563</guid>
      <dc:creator>quasenada</dc:creator>
      <dc:date>2018-03-13T20:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: Moving values row up</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Moving-values-row-up/m-p/445335#M111575</link>
      <description>&lt;P&gt;The way you posted the data is &lt;STRONG&gt;very&lt;/STRONG&gt; hard to read and the result is not very clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The best way to post data is to use a data step so others have data to actually manipulate. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best is to actually post the result for a given example data set.&lt;/P&gt;
&lt;P&gt;I am not sure if you want a data set or report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 21:52:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Moving-values-row-up/m-p/445335#M111575</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-13T21:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Moving values row up</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Moving-values-row-up/m-p/445356#M111583</link>
      <description>&lt;P&gt;Dear ballardw, thanks for you help. Sorry for the way I posted my question, this was my first time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I now post again giving a example of how my data is and how I want to reshape it. Attached to this post you find a "datahave" file that represents how my data is organized and another "datawant" that represents how I want them to be. You can use the following program to import the data.&amp;nbsp;My present database is like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* Format that I have*/&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;infile "PUT HERE datahave FILE LOCATION IN YOUR COMPUTER, INCLUDIND .txt"&amp;nbsp;&lt;BR /&gt;LRECL=1000 DLM=' ' firstobs=2;&lt;BR /&gt;input&lt;BR /&gt;ID X1 X2 X3 X4 X5 X6 X7 X8 X9 Xn&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to transform in a table&amp;nbsp;of one row by ID variable.&amp;nbsp;My desired database is like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* Format that I want*/&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;infile "PUT HERE datawant FILE LOCATION, INCLUDIND .txt"&lt;BR /&gt;LRECL=1000 DLM=' ' firstobs=2;&lt;BR /&gt;input&lt;BR /&gt;ID X1 X2 X3 X4 X5 X6 X7 X8 X9 Xn&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some individuals will face just the first event and I need to code the other events' variables as missing values, other individuals will face 20 events. ID has more than 10,000 values (the database is huge). X is the year of the event variable.&lt;/P&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;As you can see for ID 3 and 4, individuals can live two different events at the same year.&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;I want to create a one row by individual table.&amp;nbsp;I have searched for this information in the forums, but I did not find anything. I tried using the following proc transpose, but the results are not what I want.&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;proc transpose data=have out=wideformat;&lt;BR /&gt;by ID;&lt;BR /&gt;var X1--Xn;&lt;BR /&gt;run;&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;Can anybody help me? Again, many thanks in advance.&lt;/DIV&gt;</description>
      <pubDate>Wed, 14 Mar 2018 00:11:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Moving-values-row-up/m-p/445356#M111583</guid>
      <dc:creator>quasenada</dc:creator>
      <dc:date>2018-03-14T00:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Moving values row up</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Moving-values-row-up/m-p/445371#M111589</link>
      <description>&lt;P&gt;The simplest method would be to use&amp;nbsp;&lt;EM&gt;autoupdate&lt;/EM&gt; :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data datawant;
update datahave(obs=0) datahave;
by id;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Mar 2018 03:36:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Moving-values-row-up/m-p/445371#M111589</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-03-14T03:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Moving values row up</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Moving-values-row-up/m-p/445524#M111651</link>
      <description>&lt;P&gt;It works&amp;nbsp;perfectly as I wanted. Thank you so much!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2018 16:00:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Moving-values-row-up/m-p/445524#M111651</guid>
      <dc:creator>quasenada</dc:creator>
      <dc:date>2018-03-14T16:00:14Z</dc:date>
    </item>
  </channel>
</rss>

