<?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 replace character and number values in text file with SAS? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-replace-character-and-number-values-in-text-file-with-SAS/m-p/591910#M15293</link>
    <description>&lt;P&gt;Do you have your data in SAS yet? If not the first step is to read the file. Possibly use the wizard for Import data would be the best start.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is your membered actually a numeric value or character holding digits? This is import as the techniques would differ.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the variable is actually numeric then just use:&lt;/P&gt;
&lt;P&gt;id = 9999;&lt;/P&gt;
&lt;P&gt;If the membered is character with digits then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;id = translate(id,&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'999999999'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'1234567890'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;one way to replace the last n characters &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;name = cats(substr(name,&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;),repeat(&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'*'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;,length(substr(name,&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;2&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;))));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;Personally&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Sep 2019 16:07:36 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-09-26T16:07:36Z</dc:date>
    <item>
      <title>How to replace character and number values in text file with SAS?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-replace-character-and-number-values-in-text-file-with-SAS/m-p/591905#M15290</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to replace characters and digits of some variables in text file for masking purposes. The input is txt file and output is txt file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want ID varaibles to replaced with 9999 and FirstName and LastName variables replaced with * leaving the first letter of the name as is in the source text file. I am using SAS EG 7.15 HF8.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example: MemberID: 123456 to 999999&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FirstName: John to J***&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LastName:&amp;nbsp; Doe to D**&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 15:56:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-replace-character-and-number-values-in-text-file-with-SAS/m-p/591905#M15290</guid>
      <dc:creator>bayar</dc:creator>
      <dc:date>2019-09-26T15:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace character and number values in text file with SAS?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-replace-character-and-number-values-in-text-file-with-SAS/m-p/591909#M15292</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have;
MemberID="123456";
FirstName="John";
LastName="Doe";output;
run;

Data want;
length MemberID FirstName LastName $10.;
set have;
MemberID="999999";
substr(firstname,2)="***";
substr(LastName,2)="***";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Sep 2019 16:06:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-replace-character-and-number-values-in-text-file-with-SAS/m-p/591909#M15292</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2019-09-26T16:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace character and number values in text file with SAS?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-replace-character-and-number-values-in-text-file-with-SAS/m-p/591910#M15293</link>
      <description>&lt;P&gt;Do you have your data in SAS yet? If not the first step is to read the file. Possibly use the wizard for Import data would be the best start.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is your membered actually a numeric value or character holding digits? This is import as the techniques would differ.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the variable is actually numeric then just use:&lt;/P&gt;
&lt;P&gt;id = 9999;&lt;/P&gt;
&lt;P&gt;If the membered is character with digits then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;id = translate(id,&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'999999999'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'1234567890'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;one way to replace the last n characters &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;name = cats(substr(name,&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;),repeat(&lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'*'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;,length(substr(name,&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;2&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;))));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;Personally&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 16:07:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-replace-character-and-number-values-in-text-file-with-SAS/m-p/591910#M15293</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-26T16:07:36Z</dc:date>
    </item>
  </channel>
</rss>

