<?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: Splitting a text using substr in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166765#M43196</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="9177" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: I think data_null_ only used that to show you what the results looked like.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data_null_: Thanks!&amp;nbsp; I can't recall ever even seeing that function (i.e., subpad)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Dec 2013 22:34:47 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2013-12-09T22:34:47Z</dc:date>
    <item>
      <title>Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166755#M43186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have a column of codes containing alphanumeric characters:&lt;/P&gt;&lt;P&gt;Code&lt;/P&gt;&lt;P&gt;1A2B3C4D&lt;/P&gt;&lt;P&gt;2B3C3D&lt;/P&gt;&lt;P&gt;1A1G2C2B3A&lt;/P&gt;&lt;P&gt;and so on....&lt;/P&gt;&lt;P&gt;I need to split the code into 2-character variables thus:&lt;/P&gt;&lt;P&gt;Code&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type_a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type_b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type_c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type_d&lt;/P&gt;&lt;P&gt;1A2B3C4D&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4D&lt;/P&gt;&lt;P&gt;2B3C3D&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3D&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code I am using:&lt;/P&gt;&lt;P&gt;data f12;&lt;/P&gt;&lt;P&gt;set f12;&lt;/P&gt;&lt;P&gt;type_a=substr(code,1,2);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;type_b=substr(code,3,2);&lt;/P&gt;&lt;P&gt;type_c=substr(code,5,2);&lt;/P&gt;&lt;P&gt;type_d=substr(code,7,2);&lt;/P&gt;&lt;P&gt;type_e=substr(code,9,2);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;The code runs but returns this error: NOTE: Invalid second argument to function SUBSTR at line 2007 column 8.&lt;/P&gt;&lt;P&gt;Each time, I run the code, the error pertains to a different line/row.&lt;/P&gt;&lt;P&gt;I thought I could use substrn to avoid the problem but I was testing the difference in output with both substr and substrn but the results come off the same.&lt;/P&gt;&lt;P&gt;Should I use the Strip or Trim function as in: type_a=substr(trim(code),1,2)?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Dec 2013 00:04:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166755#M43186</guid>
      <dc:creator>namrata</dc:creator>
      <dc:date>2013-12-07T00:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166756#M43187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On your second observation, when you run type_d, the values to substr are invalid because they're out of bounds, the string is too short. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suggest a loop instead. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; have;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;length&lt;/SPAN&gt; code &lt;SPAN style="color: #009193;"&gt;$10.&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;input&lt;/SPAN&gt; code;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #0433ff;"&gt;cards&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;1A2B3C4D&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;2B3C3D&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;1A1G2C2B3A&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #011993;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; want;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;set&lt;/SPAN&gt; have;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;array&lt;/SPAN&gt; type(&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;5&lt;/STRONG&gt;&lt;/SPAN&gt;) $ type_a type_b type_c type_d type_e;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;i=&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;; j=&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;do&lt;/SPAN&gt; &lt;SPAN style="color: #0433ff;"&gt;while&lt;/SPAN&gt;(j-&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;lt;length(code));&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;type(i)=substr(code, j, &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;i+&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;j+&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #0433ff;"&gt;end&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #011993;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Dec 2013 00:40:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166756#M43187</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-12-07T00:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166757#M43188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your problem is that the variable CODE must have been defined as length $9.&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;So you cannot use SUBSTR(CODE,9,2) because 2 is an impossible length when starting on the last character.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One way to avoid having to specify the length is to let SAS do the truncation by defining the target variables as length $2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data f12;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set f12;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; array type $2 type1-type5;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp; do i=1 to 5 while (2*i-1 &amp;lt;= length(code));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type(i) = substr(code,2*i-1) ;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Dec 2013 01:22:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166757#M43188</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-12-07T01:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166758#M43189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot,Reeze and Tom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a quick question: I understand that the string in my variable' is too short for type_d for some of the observations.&lt;/P&gt;&lt;P&gt;However, why does the code run in some cases even when the string is too short- the error is returned for different rows every time I run the code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another question is I am trying to import a csv dataset that contains variables for address and dates too. I use Proc Import and the log shows the number of observations,rows/variables created in SAS. The dataset is therefore, created.The log however, also gives a message that the import is unsuccessful and when I scroll up, I find errors regarding invalid data for date. Is the message 'import unsuccessful' just because of those 'invalid data' errors? In that case, I can actually ignore the message since I shall anyway drop the variables for address and date.&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Dec 2013 02:28:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166758#M43189</guid>
      <dc:creator>namrata</dc:creator>
      <dc:date>2013-12-07T02:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166759#M43190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The row reference that the error return are from the line number of the code submitted, not with your observations.&amp;nbsp; Since each code is submitted with new line numbers the location of the error changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please post your new question as a different post.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Dec 2013 02:32:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166759#M43190</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-12-07T02:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166760#M43191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you use PROC IMPORT to convert a CSV file to a SAS dataset it will have to GUESS what type of variable to define for each column. CSV files have no place store variable definitions.&amp;nbsp; So some CSV files the maximum length of the value in the "CODE" column might be 8 and in others it might be 10.&amp;nbsp; So sometimes PROC IMPORT will define it with length $8 and other times it will be defined as length $10.&amp;nbsp; (Not to mention when it only sees digits in the field so it defines CODE as number instead of character)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your files have a regular structure then just write a data step to read the CSV file and then you have complete control over how the variables are defined.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Dec 2013 02:41:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166760#M43191</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-12-07T02:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166761#M43192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SUBPAD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;18&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data _null_;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;19&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a=&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'abc'&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;20&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x = subpad(a,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;3&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;2&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;21&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put (_all_)(=);&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;22&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;a=abc x=c&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Dec 2013 14:26:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166761#M43192</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-12-07T14:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166762#M43193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, everyone! I really appreciate the feedback.&lt;/P&gt;&lt;P&gt;@Tom: You had explained the datastep/proc import in another post(below)-specify the length of the variables. Is that what you are suggesting that I should do?&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/thread/40451"&gt;https://communities.sas.com/thread/40451&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In this case, I shall anyway drop the variables(with respect to which the errors are mentioned in SAS log).&amp;nbsp; Should I still be concerned if there is a message 'Import unsuccessful'?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Dec 2013 18:34:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166762#M43193</guid>
      <dc:creator>namrata</dc:creator>
      <dc:date>2013-12-09T18:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166763#M43194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In general if you want to do a quick ad hoc usage of an unknown CSV file then PROC IMPORT is pretty good, but know its limitations.&amp;nbsp; However if you are going to be doing this frequently and the format of the CSV is supposed to be standardized then you should read it in with a data step.&amp;nbsp; Especially if you will be combine the data with other data where the type and length of the variables could caused trouble.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your original issue changing the program to use SUBPAD() function instead of SUBSTR() function should eliminate the errors about invalid argurments for SUBSTR().&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Dec 2013 18:55:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166763#M43194</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-12-09T18:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166764#M43195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well,SUBPAD() works!Thank you,data_null_.&amp;nbsp; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;Had a quick question while I change my codes. What is the purpose of the statement 'put (_all_)(=);' above in the SUBPAD() command?&lt;/P&gt;&lt;P&gt;Namrata&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Dec 2013 22:17:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166764#M43195</guid>
      <dc:creator>namrata</dc:creator>
      <dc:date>2013-12-09T22:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166765#M43196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="9177" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: I think data_null_ only used that to show you what the results looked like.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data_null_: Thanks!&amp;nbsp; I can't recall ever even seeing that function (i.e., subpad)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Dec 2013 22:34:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166765#M43196</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-12-09T22:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166766#M43197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Arthur! I never used the put statement and so was unsure &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Dec 2013 22:44:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166766#M43197</guid>
      <dc:creator>namrata</dc:creator>
      <dc:date>2013-12-09T22:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166767#M43198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could also do it this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (keep = codes type_a type_b type_c type_d type_e) ;&lt;/P&gt;&lt;P&gt;length type_a type_b type_c type_d type_e $2 ;&lt;/P&gt;&lt;P&gt;set have ;&lt;/P&gt;&lt;P&gt;ExpressionID = prxparse('/\d\w/');&lt;/P&gt;&lt;P&gt;start = 1;&lt;/P&gt;&lt;P&gt;stop = length(codes);&lt;/P&gt;&lt;P&gt;array tcodes{5} $ type_a type_b type_c type_d type_e ;&lt;/P&gt;&lt;P&gt;call prxnext(ExpressionID, start, stop, codes, position, length);&lt;/P&gt;&lt;P&gt;do i = 1 to 5 ;&lt;/P&gt;&lt;P&gt;if position &amp;gt; 0 then do ;&lt;/P&gt;&lt;P&gt;tcodes{i} = substr(codes, position, length);&lt;/P&gt;&lt;P&gt;call prxnext(ExpressionID, start, stop, codes, position, length);&lt;/P&gt;&lt;P&gt;end ;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Dec 2013 00:00:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166767#M43198</guid>
      <dc:creator>SteveNZ</dc:creator>
      <dc:date>2013-12-10T00:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166768#M43199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well,&lt;/P&gt;&lt;P&gt;Why don't we include Macros in this topic.&lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the way by using Macros,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; A;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; Code $;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: #ffffc0; color: black; font-size: 10pt;"&gt;1A2B3C4D&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: #ffffc0; color: black; font-size: 10pt;"&gt;2A3B4C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: #ffffc0; color: black; font-size: 10pt;"&gt;1A2B&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;%MACRO&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; &lt;STRONG&gt;&lt;EM&gt;t&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;Data Aa;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;Set A;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; i = &lt;/SPAN&gt;&lt;SPAN style="color: teal; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;%to&lt;/SPAN&gt; &lt;SPAN style="color: teal; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;8&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;%by&lt;/SPAN&gt; &lt;SPAN style="color: teal; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;Var&amp;amp;i=Subpad(Code,&amp;amp;i,&lt;/SPAN&gt;&lt;SPAN style="color: teal; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;%&lt;STRONG&gt;&lt;EM&gt;t&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sanjeev.K&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: sajeev kuridi&#xD;
Substr function replae with Subpad.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Dec 2013 05:45:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166768#M43199</guid>
      <dc:creator>kuridisanjeev</dc:creator>
      <dc:date>2013-12-10T05:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166769#M43200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@ &lt;A __default_attr="4777" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;For me macro code is harder to read than normal base SAS code so my personal approach is to only use macro coding if there is a real gain in doing so. Also: You're still using "substr()" instead of "subpad()" so the initial issue would remain.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Dec 2013 09:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166769#M43200</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-12-10T09:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166770#M43201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;STRONG&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="-1" data-externalid="" data-presence="null" data-userid="12296" data-username="Patrick" href="https://communities.sas.com/people/Patrick" id="jive-122962049154303993711"&gt;Patrick&lt;/A&gt; ,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not saying that my approach is the best one, but this is the one for the people who don't like complex do loops or Perl regular expressions.&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And while writing the code,i thought of use Subpad function,but my fingers automatically typed Substr function as i am frequent user of that function&lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt; ,infact i haven't recognised that typo..Thanks for correcting me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sanjeev.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Dec 2013 10:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166770#M43201</guid>
      <dc:creator>kuridisanjeev</dc:creator>
      <dc:date>2013-12-10T10:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a text using substr</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166771#M43202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;P&gt;You are right. Since I was using Proc Import for a couple of datasets and now, am trying to vertically combine some of these processed datafiles, the error pops up: a couple of variables are numeric in some places while in others it is character.&lt;/P&gt;&lt;P&gt;Well, I see that I shall need to use a data step to import my data files &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;Thanks everyone!!&lt;/P&gt;&lt;P&gt;You all are a great help &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;Namrata&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Dec 2013 21:34:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Splitting-a-text-using-substr/m-p/166771#M43202</guid>
      <dc:creator>namrata</dc:creator>
      <dc:date>2013-12-10T21:34:37Z</dc:date>
    </item>
  </channel>
</rss>

