<?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 create new row for each character in each row of my variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260423#M50533</link>
    <description>&lt;P&gt;How about this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	length specchar $1 charvar $80;
	input id charvar &amp;amp; $char80.;

	do i=1 to length(charvar);
		specchar = substr(charvar, i, 1);
		output;
	end;

	drop charvar i;
	cards;
1 een lekker lange tekst met 1 of 2 cijfers erin
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 31 Mar 2016 14:23:15 GMT</pubDate>
    <dc:creator>jklaverstijn</dc:creator>
    <dc:date>2016-03-31T14:23:15Z</dc:date>
    <item>
      <title>How to create new row for each character in each row of my variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260416#M50530</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a situation where I'm trying to track some user entered data.&amp;nbsp; They can enter data into a field on my website.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have compressed all letters and numbers and now want to take the special characters and create a table with 1 row per character with the id.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;id=1 text='(+)'&lt;/P&gt;
&lt;P&gt;id=2 text='(=)(=)'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to create a table that will have the following data&amp;amp;colon;&lt;/P&gt;
&lt;P&gt;id=1 specChar= '('&lt;/P&gt;
&lt;P&gt;id=1 specChar= '+'&lt;/P&gt;
&lt;P&gt;id=1 specChar= ')'&lt;/P&gt;
&lt;P&gt;id=2 specChar= '('&lt;/P&gt;
&lt;P&gt;id=2 specChar= '='&lt;/P&gt;
&lt;P&gt;id=2 specChar= ')'&lt;/P&gt;
&lt;P&gt;id=2 specChar= '('&lt;/P&gt;
&lt;P&gt;id=2 specChar= '='&lt;/P&gt;
&lt;P&gt;id=2 specChar= ')'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was looking a using a loop with substr, but I can't figure out how the syntax would be.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 14:11:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260416#M50530</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2016-03-31T14:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to create new row for each character in each row of my variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260418#M50531</link>
      <description>&lt;P&gt;CHAR similar&amp;nbsp;to SUBSTR and has the advantage of defining new variable with the proper length 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
   id=1; text='(+)'; output;
   id=2; text='(=)(=)'; output;
   run;
data b;
   set a;
   do i = 1 to length(text);
      char = char(text,i);
      output;
      end;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Mar 2016 14:18:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260418#M50531</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-31T14:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create new row for each character in each row of my variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260422#M50532</link>
      <description>&lt;P&gt;Out of interest, why split them up into one row per character? &amp;nbsp;It looks like a formula of some kind, perhaps pattern matching (Perl Regular Expressions or similar) may be more effective, however depends on purpose of course.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 14:23:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260422#M50532</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-03-31T14:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create new row for each character in each row of my variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260423#M50533</link>
      <description>&lt;P&gt;How about this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	length specchar $1 charvar $80;
	input id charvar &amp;amp; $char80.;

	do i=1 to length(charvar);
		specchar = substr(charvar, i, 1);
		output;
	end;

	drop charvar i;
	cards;
1 een lekker lange tekst met 1 of 2 cijfers erin
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Mar 2016 14:23:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260423#M50533</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2016-03-31T14:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to create new row for each character in each row of my variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260428#M50534</link>
      <description>&lt;P&gt;Here's a small issue to consider.&amp;nbsp; Is it possible that the incoming field will be blank?&amp;nbsp; If so, do you want to output a single blank (vs. output no record at all)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The LENGTH function returns a minimum value of 1, even when the incoming field is blank.&amp;nbsp; You might want to condition on:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if text &amp;gt; ' ' then do i=1 to ...;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 14:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260428#M50534</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-31T14:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create new row for each character in each row of my variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260429#M50535</link>
      <description>&lt;P&gt;Thanks data_null_.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That worked perfect for me.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 14:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260429#M50535</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2016-03-31T14:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create new row for each character in each row of my variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260433#M50537</link>
      <description>&lt;P&gt;We have a site where users can put in code as if it was a where condition.&amp;nbsp; I want to pull out all the special characters by ID and then I'm going to roll them up into a count to see how many special characters are used.&amp;nbsp; Then I can investigate what special characters are causing issues and exclude them from being used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the steps my lead has asked me to take.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you to all who replied.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 14:36:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260433#M50537</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2016-03-31T14:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create new row for each character in each row of my variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260434#M50538</link>
      <description>&lt;P&gt;I'm doing that check in the data table before I use data_null_'s code.&amp;nbsp; So it will eleminate any blank rows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for pointing that out.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 14:37:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-new-row-for-each-character-in-each-row-of-my/m-p/260434#M50538</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2016-03-31T14:37:34Z</dc:date>
    </item>
  </channel>
</rss>

