<?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: modifying my table in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682707#M24129</link>
    <description>&lt;P&gt;I understand that. I still don't see any benefit from doing this conversion of the data to have just 5 in a row. What can you do with this conversion that you wouldn't be able to do if you left it unchanged?&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2020 16:43:54 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-09-09T16:43:54Z</dc:date>
    <item>
      <title>modifying my table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682651#M24121</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;my data is just a list of words (txt file) and I managed to import data into a table.&lt;/P&gt;&lt;P&gt;Since the lines have different number of words, the imported data have different number of columns.&lt;/P&gt;&lt;P&gt;The row with the most columns has 42 columns.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to do is if a row has more than 10 columns (that is, if a row has more than 10 words) move the following columns to the next row&lt;/P&gt;&lt;P&gt;For example (5 columns in this case)&lt;/P&gt;&lt;P&gt;if I have this as my data,&lt;/P&gt;&lt;P&gt;a b c d e f g h i&lt;/P&gt;&lt;P&gt;a b c d&amp;nbsp;&lt;/P&gt;&lt;P&gt;a b c d e f g&lt;/P&gt;&lt;P&gt;a b&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want to make&lt;/P&gt;&lt;P&gt;a b c d e&lt;/P&gt;&lt;P&gt;f g h i&lt;/P&gt;&lt;P&gt;a b c d&lt;/P&gt;&lt;P&gt;a b c d e&lt;/P&gt;&lt;P&gt;f g&amp;nbsp;&lt;/P&gt;&lt;P&gt;a b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I do this in SAS?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 14:22:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682651#M24121</guid>
      <dc:creator>billseol</dc:creator>
      <dc:date>2020-09-09T14:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: modifying my table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682678#M24122</link>
      <description>You can but it would be better to change the import program used to read the data instead.</description>
      <pubDate>Wed, 09 Sep 2020 15:51:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682678#M24122</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-09-09T15:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: modifying my table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682682#M24123</link>
      <description>&lt;P&gt;Hard to see a benefit of this somewhat arbitrary re-arranging of the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have&amp;nbsp;&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;a b c d e f g h i&lt;/FONT&gt; then you know &lt;FONT face="courier new,courier"&gt;f&lt;/FONT&gt; is in the sixth position.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you modify this to&lt;FONT face="courier new,courier"&gt;&amp;nbsp;a b c d e&lt;/FONT&gt; in row 1 and&amp;nbsp;&lt;FONT face="courier new,courier"&gt;f g h i&lt;/FONT&gt; in row 2, then &lt;FONT face="courier new,courier"&gt;a&lt;/FONT&gt; in row 1 and &lt;FONT face="courier new,courier"&gt;f&lt;/FONT&gt; in row 2 are in the same columns and have the same variable name, and you lose the relationship between the character strings in the original data.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Why do you want to do this?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 15:56:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682682#M24123</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-09T15:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: modifying my table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682700#M24126</link>
      <description>which program would you suggest?</description>
      <pubDate>Wed, 09 Sep 2020 16:23:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682700#M24126</guid>
      <dc:creator>billseol</dc:creator>
      <dc:date>2020-09-09T16:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: modifying my table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682702#M24127</link>
      <description>technically, the data i have doesn't have any relationship between each value. I just want the data in set number of columns without changing the order of the data or the order of each row.</description>
      <pubDate>Wed, 09 Sep 2020 16:25:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682702#M24127</guid>
      <dc:creator>billseol</dc:creator>
      <dc:date>2020-09-09T16:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: modifying my table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682707#M24129</link>
      <description>&lt;P&gt;I understand that. I still don't see any benefit from doing this conversion of the data to have just 5 in a row. What can you do with this conversion that you wouldn't be able to do if you left it unchanged?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 16:43:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682707#M24129</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-09T16:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: modifying my table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682711#M24130</link>
      <description>It's just for my own interest.&lt;BR /&gt;Ok let me change my question then.&lt;BR /&gt;Is there a way to move certain values to another location?&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Sep 2020 17:00:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682711#M24130</guid>
      <dc:creator>billseol</dc:creator>
      <dc:date>2020-09-09T17:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: modifying my table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682712#M24131</link>
      <description>&lt;P&gt;Well, I'm sure there is a way, but I don't have any brilliant ideas right now. Maybe some of the hash experts in the SAS Communities can do this quickly (but I am not one of them).&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 17:02:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682712#M24131</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-09T17:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: modifying my table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682714#M24132</link>
      <description>&lt;P&gt;Check next tested code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have; 
 retain nwords;
 infile cards truncover;
 input text $char80.;
 nwords = countw(text);
cards;
a b c d e f g h i
a b c d 
a b c d e f g
a b 
; run;

%let maxo=4;
data want(keep=wout1-wout&amp;amp;maxo);
     length wout1-wout&amp;amp;maxo $5;
 set have; 
     array wordot {&amp;amp;maxo} $ wout1-wout&amp;amp;maxo; 
     j=0; i=0;
     do until (i=nwords);
        do until (j=&amp;amp;maxo or i=nwords);
           j = j+1; i=i+1; put i= j=;
           wordot(j) = scan(text,i);
        end;
        if wout1 ne ' ' then output;
        do j=1 to &amp;amp;maxo; wordot(j) = ' '; end;
        j=0;
     end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Why are you splitting the text into columns of one word each ?&lt;/P&gt;
&lt;P&gt;Why not just splitting the long text into limited length&amp;nbsp; sub-strings ?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 17:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682714#M24132</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-09-09T17:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: modifying my table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682729#M24134</link>
      <description>&lt;P&gt;One variable would be better than 5 or 10.&lt;/P&gt;
&lt;P&gt;If you have a unique row identifier just use PROC TRANSPOSE.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=have out=want;
  by rowid;
  var var1-var10;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Sep 2020 18:25:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682729#M24134</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-09-09T18:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: modifying my table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682766#M24137</link>
      <description>&lt;P&gt;It is not hard to do when just reading from a text.&amp;nbsp; First let's make a sample text file.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options parmcards=txt;
filename txt temp;
parmcards4;
a b c d e f g h i
a b c d
a b c d e f g
a b
;;;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now just read 5 words at a time and hold the line. Stop when you have read past the end of the line.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  infile txt truncover length=ll column=cc ;
  row+1;
  do until(cc&amp;gt;ll);
    input (v1-v5) (:$10.) @;
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;Obs    row    v1    v2    v3    v4    v5

 1      1     a     b     c     d     e
 2      1     f     g     h     i
 3      2     a     b     c     d
 4      3     a     b     c     d     e
 5      3     f     g
 6      4     a     b&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Sep 2020 20:16:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682766#M24137</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-09-09T20:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: modifying my table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682816#M24140</link>
      <description>This is exactly what I wanted.&lt;BR /&gt;Thank for the simple method.&lt;BR /&gt;I really appreciate it.</description>
      <pubDate>Thu, 10 Sep 2020 04:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682816#M24140</guid>
      <dc:creator>billseol</dc:creator>
      <dc:date>2020-09-10T04:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: modifying my table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682916#M24143</link>
      <description>&lt;PRE&gt;data want ;
  infile cards truncover ;
  row+1;
  input (v1-v5) (:$10.) @;
  do while( cmiss(of v1-v5) &amp;lt;5);
    output;
    input (v1-v5) (:$10.) @; 
  end;
cards;
a b c d e f g h i
a b c d
a b c d e f g
a b
;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Sep 2020 12:14:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/modifying-my-table/m-p/682916#M24143</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-09-10T12:14:46Z</dc:date>
    </item>
  </channel>
</rss>

