<?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: how to do the table? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-do-the-table/m-p/486256#M126497</link>
    <description>&lt;P&gt;Are the numbers of words always the same for a given observation in try?&lt;/P&gt;
&lt;P&gt;That would enable using a for loop, otherwise you'd need a do while:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (keep=id word1 word2);
set try (rename=(word1=_word1 word2=_word2));
i = 1;
word1 = scan(_word1,1,'|');
word2 = scan(_word2,1,'|');
do while (word1 ne '' or word2 ne '');
  output;
  i + 1;
  word1 = scan(_word1,i,'|');
  word2 = scan(_word2,i,'|');
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Not tested, as I'm on my tablet.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Aug 2018 05:50:44 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-08-13T05:50:44Z</dc:date>
    <item>
      <title>how to do the table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-do-the-table/m-p/486227#M126475</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two questions here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One is how to make the table like following 'want' from data try.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another question is how to input the string with blank. For example, input the words 'the &lt;SPAN&gt;number/of/ those words &lt;/SPAN&gt;' instead of '&lt;SPAN&gt;number/of/word&lt;/SPAN&gt;'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;want&lt;BR /&gt;ID city &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; word1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; word2&lt;BR /&gt;1&amp;nbsp; steelcity &amp;nbsp; &amp;nbsp;&amp;nbsp; word/&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; assign/&lt;BR /&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; in/ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; values/&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; character/ &amp;nbsp;&amp;nbsp; to/&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; another&lt;BR /&gt;6&amp;nbsp; greenhills &amp;nbsp; word/&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; assign/&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; in/ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; values/&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &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; to/&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; other&lt;BR /&gt;17&amp;nbsp; hills &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Searching/&amp;nbsp; number/&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; Character/ &amp;nbsp; of/&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; String &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; word&lt;/P&gt;&lt;P&gt;One is how to make the table like 'want'.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data try;
length city word1 word2 $100.;
input id city$ word1$ word2$;

datalines;
1 steelcity word/in/character/string assign/values/to/another
6 greenhills word/in/a/string assign/values/to/other
17 hills Searching/Character/String number/of/word 
;
run;

want 
ID city        word1          word2
1  steelcity  word/          assign/
	in/			 values/
			  character/     to/
			  string         another
6  greenhills word/          assign/
			  in/		     values/
			  a/             to/
              string 	     other
17  hills     Searching/     number/
              Character/     of/
              String         word&lt;/CODE&gt;&lt;/PRE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 02:01:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-do-the-table/m-p/486227#M126475</guid>
      <dc:creator>xiangpang</dc:creator>
      <dc:date>2018-08-13T02:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to do the table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-do-the-table/m-p/486252#M126495</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
  length CITY WORD1 WORD2  $100.;
  input ID CITY $ WORD1 &amp;amp; $ WORD2 &amp;amp; $;
datalines;
1 steelcity  word/in/character/string  assign/values/to/another
6 greenhills  word/in/a/string  assign/values/to/other
17 hills  Searching/Character/String  number/two words 
run;
data WANT;
  set HAVE;
  do I=1 to max(countw(WORD1,'/'), countw(WORD2,'/'));
    W1=scan(WORD1,I,'/');
    if scan(WORD1,I+1,'/') ne ' ' then W1=catt(W1,'/'); 
    W2=scan(WORD2,I,'/');
    if scan(WORD2,I+1,'/') ne ' ' then W2=catt(W2,'/');
    output;
    call missing(ID,CITY);
  end;
  keep ID CITY W1 W2;
  rename W1=WORD1 W2=WORD2;
run; 



&lt;/CODE&gt;&lt;/PRE&gt;
&lt;TABLE style="border-collapse: collapse; width: 192pt;" border="0" width="256" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;CITY&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;WORD1&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;WORD2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;steelcity&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD&gt;word/&lt;/TD&gt;
&lt;TD&gt;assign/&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;in/&lt;/TD&gt;
&lt;TD&gt;values/&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;character/&lt;/TD&gt;
&lt;TD&gt;to/&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;string&lt;/TD&gt;
&lt;TD&gt;another&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;greenhills&lt;/TD&gt;
&lt;TD align="right"&gt;6&lt;/TD&gt;
&lt;TD&gt;word/&lt;/TD&gt;
&lt;TD&gt;assign/&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;in/&lt;/TD&gt;
&lt;TD&gt;values/&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;a/&lt;/TD&gt;
&lt;TD&gt;to/&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;string&lt;/TD&gt;
&lt;TD&gt;other&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;hills&lt;/TD&gt;
&lt;TD align="right"&gt;17&lt;/TD&gt;
&lt;TD&gt;Searching/&lt;/TD&gt;
&lt;TD&gt;number/&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;Character/&lt;/TD&gt;
&lt;TD&gt;two words&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;String&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 05:46:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-do-the-table/m-p/486252#M126495</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-08-13T05:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to do the table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-do-the-table/m-p/486256#M126497</link>
      <description>&lt;P&gt;Are the numbers of words always the same for a given observation in try?&lt;/P&gt;
&lt;P&gt;That would enable using a for loop, otherwise you'd need a do while:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (keep=id word1 word2);
set try (rename=(word1=_word1 word2=_word2));
i = 1;
word1 = scan(_word1,1,'|');
word2 = scan(_word2,1,'|');
do while (word1 ne '' or word2 ne '');
  output;
  i + 1;
  word1 = scan(_word1,i,'|');
  word2 = scan(_word2,i,'|');
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Not tested, as I'm on my tablet.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 05:50:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-do-the-table/m-p/486256#M126497</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-13T05:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to do the table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-do-the-table/m-p/486257#M126498</link>
      <description>&lt;P&gt;For the Second kind of question, I suggest you Proc Format which is easy to use.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc format;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; value $ change ( this is your choice of name)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "&lt;SPAN&gt;number/of/word&lt;/SPAN&gt;"="&lt;SPAN&gt;the &lt;/SPAN&gt;&lt;SPAN&gt;number/of/ those words&lt;/SPAN&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the first question, I am trying but not getting your question somehow, if you can explain I would like to help you out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think you can use proc report for this kind of scenario but before that, you need to rearrange&amp;nbsp;data.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 05:52:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-do-the-table/m-p/486257#M126498</guid>
      <dc:creator>shahparth260</dc:creator>
      <dc:date>2018-08-13T05:52:49Z</dc:date>
    </item>
  </channel>
</rss>

