<?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: split string into multiple variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806783#M317937</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yikes.&amp;nbsp; Only works if the new variables are contiguous in memory.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Apr 2022 14:08:14 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-04-08T14:08:14Z</dc:date>
    <item>
      <title>split string into multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806693#M317874</link>
      <description>&lt;P&gt;string can be of any length(dynamic), split it into mulitple variables with a limit 200 for each variables its should be dynamic&lt;BR /&gt;example "FAOBJ_1" to "FAOBJ_&amp;lt;n&amp;gt;",&lt;BR /&gt;example "AE Term - 1" to "AE Term - &amp;lt;n&amp;gt;"&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 05:18:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806693#M317874</guid>
      <dc:creator>Rajesh42z</dc:creator>
      <dc:date>2022-04-08T05:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: split string into multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806700#M317879</link>
      <description>&lt;P&gt;Examples without rules can not be programmed to be very flexible. What are the &lt;STRONG&gt;rules&lt;/STRONG&gt; for splitting the values.&lt;/P&gt;
&lt;P&gt;Provide some examples where the lengths of the source strings are over 200 and what the resulting 200 length values look like after applying the rules.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not at all sure what your example is even suggesting. I do not see anything split. What I see is "replace 1 with &amp;lt;n&amp;gt;". Split implies that the result is two or more different values into two variables and you only show one result.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 06:13:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806700#M317879</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-08T06:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: split string into multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806727#M317903</link>
      <description>&lt;P&gt;q1="&lt;FONT color="#FF0000"&gt;Patient's symptoms and behaviors of the psychiatric AE are similar to the ones that patient is normally experiencing. They are not different from the symptoms patient had when he got&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;admitted to the hospital and which we observed during visits 1and 2. Patient remained hearing voices of imperative and commenting nature in his head, he retained ideas of external influence&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;on his thoughts and body. As he was receiving the studied drug, anxiety levels have decreased and sleep quality has improved. However, psychosis has remained during visits 9 and 10, for this reason patient needed to remain in the hospital for treatment. According to the Study Protocol, this situation was registered as SAE.&lt;/FONT&gt;"&lt;/P&gt;&lt;P&gt;q1 is the string with length of&amp;nbsp; 694&amp;nbsp; &amp;nbsp;not the same for other records so we need to spllit this string into multiple variables so here we will have to create 4(this also has to be dynamic) variables one String=""/String1=""/String2=""/String3=""&lt;/P&gt;&lt;P&gt;1st first string with 1-199&lt;/P&gt;&lt;P&gt;2nd string 200-399&lt;/P&gt;&lt;P&gt;3rd string 400-599&lt;/P&gt;&lt;P&gt;4th string 600-694&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the above is just one sencario we have string with length of 745/480&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 08:55:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806727#M317903</guid>
      <dc:creator>Rajesh42z</dc:creator>
      <dc:date>2022-04-08T08:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: split string into multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806733#M317906</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;q1="&lt;FONT color="#FF0000"&gt;Patient's symptoms and behaviors of the psychiatric AE are similar to the ones that patient is normally experiencing. They are not different from the symptoms patient had when he got&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;admitted to the hospital and which we observed during visits 1and 2. Patient remained hearing voices of imperative and commenting nature in his head, he retained ideas of external influence&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;on his thoughts and body. As he was receiving the studied drug, anxiety levels have decreased and sleep quality has improved. However, psychosis has remained during visits 9 and 10, for this reason patient needed to remain in the hospital for treatment. According to the Study Protocol, this situation was registered as SAE.&lt;/FONT&gt;"&lt;/P&gt;&lt;P&gt;q1 is the string with length of&amp;nbsp; 694&amp;nbsp; &amp;nbsp;not the same for other records so we need to spllit this string into multiple variables so here we will have to create 4(this also has to be dynamic) variables one String=""/String1=""/String2=""/String3=""&lt;/P&gt;&lt;P&gt;1st first string with 1-199&lt;/P&gt;&lt;P&gt;2nd string 200-399&lt;/P&gt;&lt;P&gt;3rd string 400-599&lt;/P&gt;&lt;P&gt;4th string 600-694&lt;/P&gt;&lt;P&gt;the above is just one sencario we have string with length of 745/480 and so on&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 08 Apr 2022 09:52:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806733#M317906</guid>
      <dc:creator>Rajesh42z</dc:creator>
      <dc:date>2022-04-08T09:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: split string into multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806758#M317922</link>
      <description>&lt;P&gt;Do you want the long string split into multiple VARIABLES?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  array q1_ [5] $200 ;
  do index=1 to length(q1) by 200;
     q1_[index]=substrn(q1,index,200);
  end;
  drop index;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or multiple OBSERVATIONS?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  length rowno 8 newq1 $200;
  do rowno=1 by 1 until(200*(rowno-1)&amp;gt;=length(q1));
    newq1=substrn(q1,1+200*(rowno-1),200);
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 12:56:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806758#M317922</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-08T12:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: split string into multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806780#M317936</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
q1="Patient's symptoms and behaviors of the psychiatric AE are similar to the ones that patient is normally experiencing. They are not different from the symptoms patient had when he got
admitted to the hospital and which we observed during visits 1and 2. Patient remained hearing voices of imperative and commenting nature in his head, he retained ideas of external influence
on his thoughts and body. As he was receiving the studied drug, anxiety levels have decreased and sleep quality has improved. However, psychosis has remained during visits 9 and 10, for this reason patient needed to remain in the hospital for treatment. According to the Study Protocol, this situation was registered as SAE.";
l = klength(q1);
put _all_;
   array _x[4] $200 FAOBJ_1-FAOBJ_4;
   if _n_ eq 1 then addr=addrlong(_x[1]);
   retain addr; drop addr;
   call pokelong(q1,addr,l);
   run;
proc contents varnum;
proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 155px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70241iF7658E6879F8FFB4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.PNG" style="width: 632px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70242i5A08B8BF08C3F55D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture1.PNG" alt="Capture1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 14:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806780#M317936</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2022-04-08T14:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: split string into multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806783#M317937</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yikes.&amp;nbsp; Only works if the new variables are contiguous in memory.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 14:08:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/split-string-into-multiple-variables/m-p/806783#M317937</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-08T14:08:14Z</dc:date>
    </item>
  </channel>
</rss>

