<?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: What would be the command to break this data up from long to wide (array). in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-would-be-the-command-to-break-this-data-up-from-long-to/m-p/735133#M229000</link>
    <description>&lt;P&gt;Example data of start and end are much better than showing code that doesn't do what is required.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And since your code generates errors you should share the log of the data step throwing errors. How do I know your code throws errors: This bit&lt;/P&gt;
&lt;P&gt;Var[X{i}]=X{i};&lt;/P&gt;
&lt;P&gt;Is going to throw errors because you do not have an ARRAY named X defined.&lt;/P&gt;
&lt;P&gt;Second, your X values are pretty much all larger than 10 and the array Var is only defined to have 4 elements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I might guess that you actually intend to use TIME as the index for the Var array, not x{i} [which does not exist in any form]. But since you don't show what the result is supposed to be that is just a guess.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And why "array" if proc transpose does this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 18 Apr 2021 22:16:03 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-04-18T22:16:03Z</dc:date>
    <item>
      <title>What would be the command to break this data up from long to wide (array).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-would-be-the-command-to-break-this-data-up-from-long-to/m-p/735132#M228999</link>
      <description>&lt;P&gt;Hey guys, back again. I've been asking a lot of dumb questions but I've had a really crummy weekend and my professor absolutely loaded us down and I'm just trying to get through this one the last problem. I have this data that I need to convert from tall to wisde using an array. I have it mostly done out, but I can't figure out the last few commands, namely the first and last commands as well as the variable multiplication command in the third to last line that actually helps break up the data. If someone could kindly answer that would be amazing....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data THIN;&lt;BR /&gt;Input ID $ Time X @@;&lt;BR /&gt;Datalines;&lt;BR /&gt;001 1 10 001 2 12 001 3 15&lt;BR /&gt;004 1 17&lt;BR /&gt;003 1 14 003 2 18 003 3 22 003 4 28&lt;BR /&gt;002 1 18 004 2 28&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;Proc sort data= THIN;&lt;BR /&gt;by ID;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;data Thin_Wide;&lt;BR /&gt;set THIN;&lt;BR /&gt;by ID;&lt;BR /&gt;retain X1-X4;&lt;BR /&gt;array Var[4] X1-X4;&lt;BR /&gt;if first.ID then do i=1 to 4;&lt;BR /&gt;var[i]=.;&lt;BR /&gt;end;&lt;BR /&gt;Var[X{i}]=X{i};&lt;BR /&gt;if last.ID;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 21:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-would-be-the-command-to-break-this-data-up-from-long-to/m-p/735132#M228999</guid>
      <dc:creator>FrustratedBio</dc:creator>
      <dc:date>2021-04-18T21:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: What would be the command to break this data up from long to wide (array).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-would-be-the-command-to-break-this-data-up-from-long-to/m-p/735133#M229000</link>
      <description>&lt;P&gt;Example data of start and end are much better than showing code that doesn't do what is required.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And since your code generates errors you should share the log of the data step throwing errors. How do I know your code throws errors: This bit&lt;/P&gt;
&lt;P&gt;Var[X{i}]=X{i};&lt;/P&gt;
&lt;P&gt;Is going to throw errors because you do not have an ARRAY named X defined.&lt;/P&gt;
&lt;P&gt;Second, your X values are pretty much all larger than 10 and the array Var is only defined to have 4 elements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I might guess that you actually intend to use TIME as the index for the Var array, not x{i} [which does not exist in any form]. But since you don't show what the result is supposed to be that is just a guess.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And why "array" if proc transpose does this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 22:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-would-be-the-command-to-break-this-data-up-from-long-to/m-p/735133#M229000</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-18T22:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: What would be the command to break this data up from long to wide (array).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-would-be-the-command-to-break-this-data-up-from-long-to/m-p/735137#M229002</link>
      <description>Well, the purpose of our assignment is to use the array, its actually in the chapter question. Thank a bunch for pointing that out. I actually just neglected the time variable.......again its been one of those weekends. Thanks a bunch.</description>
      <pubDate>Sun, 18 Apr 2021 22:46:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-would-be-the-command-to-break-this-data-up-from-long-to/m-p/735137#M229002</guid>
      <dc:creator>FrustratedBio</dc:creator>
      <dc:date>2021-04-18T22:46:30Z</dc:date>
    </item>
  </channel>
</rss>

