<?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 spliting variable into multiple variables without delimiter and words can cut in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/spliting-variable-into-multiple-variables-without-delimiter-and/m-p/715227#M220908</link>
    <description>&lt;P&gt;&amp;nbsp;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have below data and I want to split the variable "VAR" into multiple variables after length of 9 .So after every 9th position in the string the sentence should split cutting words is fine. Please have a look at below datasets .Thank you in advance.&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;var="I want this text to split into variables with same length";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected output:&lt;/P&gt;&lt;P&gt;var1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var7&lt;BR /&gt;I want th&amp;nbsp; &amp;nbsp; &amp;nbsp;is text&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;to split&amp;nbsp; &amp;nbsp; &amp;nbsp;into vari&amp;nbsp; &amp;nbsp; &amp;nbsp; ables wit&amp;nbsp; &amp;nbsp; &amp;nbsp;h same le&amp;nbsp; &amp;nbsp; &amp;nbsp;ngth&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jan 2021 11:52:21 GMT</pubDate>
    <dc:creator>deep_sas</dc:creator>
    <dc:date>2021-01-29T11:52:21Z</dc:date>
    <item>
      <title>spliting variable into multiple variables without delimiter and words can cut</title>
      <link>https://communities.sas.com/t5/SAS-Programming/spliting-variable-into-multiple-variables-without-delimiter-and/m-p/715227#M220908</link>
      <description>&lt;P&gt;&amp;nbsp;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have below data and I want to split the variable "VAR" into multiple variables after length of 9 .So after every 9th position in the string the sentence should split cutting words is fine. Please have a look at below datasets .Thank you in advance.&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;var="I want this text to split into variables with same length";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected output:&lt;/P&gt;&lt;P&gt;var1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var7&lt;BR /&gt;I want th&amp;nbsp; &amp;nbsp; &amp;nbsp;is text&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;to split&amp;nbsp; &amp;nbsp; &amp;nbsp;into vari&amp;nbsp; &amp;nbsp; &amp;nbsp; ables wit&amp;nbsp; &amp;nbsp; &amp;nbsp;h same le&amp;nbsp; &amp;nbsp; &amp;nbsp;ngth&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2021 11:52:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/spliting-variable-into-multiple-variables-without-delimiter-and/m-p/715227#M220908</guid>
      <dc:creator>deep_sas</dc:creator>
      <dc:date>2021-01-29T11:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: spliting variable into multiple variables without delimiter and words can cut</title>
      <link>https://communities.sas.com/t5/SAS-Programming/spliting-variable-into-multiple-variables-without-delimiter-and/m-p/715235#M220912</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   var="I want this text to split into variables with same length";
run;

data temp;
   set have;
   l = length(var);
   f = 1;
   do while (1);
      w = substr(var, f, 9);
      id + 1;
      output;
      f + 9;
      if f + 9 &amp;gt; l then do;
         w = substr(var, f);
         id + 1;
         output;
         leave;
      end;
   end;
run;

proc transpose data = temp out = want(drop = _:) prefix = var;
   id id;
   var w;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var1       var2       var3       var4       var5       var6      var7 
I want th  is text t  o split i  nto varia  bles with  same len  gth &lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Jan 2021 12:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/spliting-variable-into-multiple-variables-without-delimiter-and/m-p/715235#M220912</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-29T12:14:42Z</dc:date>
    </item>
  </channel>
</rss>

