<?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: Removing Specific Prefix from a column in Excel in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343190#M78769</link>
    <description>&lt;P&gt;Please post the complete log (using the {i} icon to preserve formatting), so we can see to which code parts the messages point.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Mar 2017 07:55:48 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-03-22T07:55:48Z</dc:date>
    <item>
      <title>Removing Specific Prefix from a column in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/342893#M78641</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have an excel file with 3 columns. Say A,B and C. Now the C column as some values like PPA249394893,PPA3949343904, CPA239483984,DEF948594 etc.. Now i need to remove the value which as prefix PPA from Column C. How to do that in SAS EG ? i have imported the file as below. I need the records which i removed(PPA Prefix records)&amp;nbsp;as well in separae dataset. Please help me to proceed further.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;IMPORT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; =Test&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datafile&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"/Test/test_file.xlsx"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DBMS&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; = XLSX&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;REPLACE&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;GETNAMES&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; = YES;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 11:00:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/342893#M78641</guid>
      <dc:creator>Abhi1212</dc:creator>
      <dc:date>2017-03-21T11:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Specific Prefix from a column in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/342902#M78645</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want1 want2;
set test;
if substr(c,1,3) = 'PPA'
then output want2;
else output want1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Mar 2017 11:54:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/342902#M78645</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-21T11:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Specific Prefix from a column in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/342916#M78650</link>
      <description>&lt;P&gt;Is this solution you are looking?&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;input C$ A B;&lt;BR /&gt;datalines;&lt;BR /&gt;PPA249394893 12 34&lt;BR /&gt;CPA239483984 23 45&lt;BR /&gt;DEF948594 56 67&lt;BR /&gt;PPA249394893 90 10&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;data ppa_test(drop=new_c) without_ppa(drop=c);&lt;BR /&gt;set test;&lt;BR /&gt;if upcase(substr(c,1,3))='PPA' then&lt;BR /&gt;do;&lt;BR /&gt;new_c=substr(c,3); output without_ppa;&lt;BR /&gt;end;&lt;BR /&gt;else output ppa_test;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 12:38:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/342916#M78650</guid>
      <dc:creator>lakshmi_74</dc:creator>
      <dc:date>2017-03-21T12:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Specific Prefix from a column in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343182#M78763</link>
      <description>Thanks for your reply Kurt. Meanwhile, Control totals should also be captured including: Totals records read, total invalid records excluded, total records output. How that can be done?</description>
      <pubDate>Wed, 22 Mar 2017 06:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343182#M78763</guid>
      <dc:creator>Abhi1212</dc:creator>
      <dc:date>2017-03-22T06:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Specific Prefix from a column in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343183#M78764</link>
      <description>&lt;P&gt;Lakshmi,&lt;/P&gt;&lt;P&gt;My input values are given through excel. So first i should import and then i should play around. Also your code is seem to be more lengthy. Just IF statement will solve. Thanks for your response.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 06:43:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343183#M78764</guid>
      <dc:creator>Abhi1212</dc:creator>
      <dc:date>2017-03-22T06:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Specific Prefix from a column in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343187#M78766</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76621"&gt;@Abhi1212&lt;/a&gt; wrote:&lt;BR /&gt;Thanks for your reply Kurt. Meanwhile, Control totals should also be captured including: Totals records read, total invalid records excluded, total records output. How that can be done?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Count during the step, and then save to macro variables for further use:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want1 want2;
set test end=done;
retain
  count_out 0
  count_x 0
;
if substr(c,1,3) = 'PPA'
then do;
  output want2;
  count_ex + 1;
end;
else do;
  output want1;
  count_out + 1;
end;
if done
then do;
  call symputx('total_read',put(_n_,best.));
  call symputx('total_output',put(count_out,best.));
  call symputx('total_excluded',put(count_ex,best.));
end;
drop count_out count_ex;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Mar 2017 07:21:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343187#M78766</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-22T07:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Specific Prefix from a column in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343188#M78767</link>
      <description>ERROR 22-322: Syntax error, expecting one of the following: ;, CANCEL, PGM.&lt;BR /&gt;&lt;BR /&gt;ERROR 202-322: The option or parameter is not recognized and will be ignored.&lt;BR /&gt;&lt;BR /&gt;I get this error</description>
      <pubDate>Wed, 22 Mar 2017 07:52:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343188#M78767</guid>
      <dc:creator>Abhi1212</dc:creator>
      <dc:date>2017-03-22T07:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Specific Prefix from a column in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343190#M78769</link>
      <description>&lt;P&gt;Please post the complete log (using the {i} icon to preserve formatting), so we can see to which code parts the messages point.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 07:55:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343190#M78769</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-22T07:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Specific Prefix from a column in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343194#M78772</link>
      <description>GOPTIONS NOACCESSIBLE;&lt;BR /&gt;________&lt;BR /&gt;22&lt;BR /&gt;202&lt;BR /&gt;&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: ;, CANCEL, PGM.&lt;BR /&gt;&lt;BR /&gt;ERROR 202-322: The option or parameter is not recognized and will be ignored.</description>
      <pubDate>Wed, 22 Mar 2017 08:02:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343194#M78772</guid>
      <dc:creator>Abhi1212</dc:creator>
      <dc:date>2017-03-22T08:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Specific Prefix from a column in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343195#M78773</link>
      <description>&lt;P&gt;I guess you are still learning about the meaning of "complete".&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 08:04:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343195#M78773</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-22T08:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Specific Prefix from a column in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343197#M78775</link>
      <description>&lt;P&gt;&lt;STRONG&gt;AND USE THE {i} ICON TO POST CODE AND LOGS!!!&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope I do not need to repeat myself once more.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 08:05:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343197#M78775</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-22T08:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Specific Prefix from a column in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343199#M78777</link>
      <description>&lt;P&gt;Sorry Kurt i udnerstood what you asked for. I rectified the error. I missed a ; in program that was the issue.&lt;/P&gt;&lt;P&gt;I saw the output i got an extra column named count_X with o values. But i need something as in the log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to send the below part in an email with invalid records file attached to it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: There were 3508 observations read from the data set WORK.TEST.&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.WANT1 has 3501 observations and 5 variables.&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.WANT2 has 7 observations and 5 variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 08:10:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343199#M78777</guid>
      <dc:creator>Abhi1212</dc:creator>
      <dc:date>2017-03-22T08:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Specific Prefix from a column in Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343200#M78778</link>
      <description>&lt;P&gt;When you send the mail using filename email, simply do this in the data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
filename emailout; /* or whatever file reference you used in filename email */
/* as one of the options in the infile statement, you can attach the want2 dataset, using its physical path */
put "&amp;amp;total_read observations were read.";
put "&amp;amp;total_output were accepted.";
put "&amp;amp;total_excluded were rejected.";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As an alternative to attaching, you could store the want2 dataset in a library that is accessible to users, and simply add the complete dataset name as text to the email. That keeps mails small (to the pleasure of your mail administrators).&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 08:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Specific-Prefix-from-a-column-in-Excel/m-p/343200#M78778</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-22T08:22:22Z</dc:date>
    </item>
  </channel>
</rss>

