<?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: reading a .txt file , searching for a specific string  doesn't work properly in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771168#M244678</link>
    <description>&lt;P&gt;Thanks Kurt , Agree that this issue is caused by special characters like '%' , in the variable. SYMGET&amp;nbsp; helps in some situations but we cannot use functions like SYMGET when we are passing as a input variable to macro's.&amp;nbsp;we like to use the string with special characters in a variable in several places of code like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example we can’t use SYMGET to pass to macro’s like below , which inturn results an error.&lt;/P&gt;
&lt;P&gt;%Test_macro (url=%sysfunc(symget(ServerRelativeUrl_new))&amp;nbsp; &amp;nbsp;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put is just to test the value of the variable , but we need to use the URL variable in different places . is there any way to deal with this issue.&lt;/P&gt;</description>
    <pubDate>Wed, 29 Sep 2021 16:32:13 GMT</pubDate>
    <dc:creator>learn_SAS_23</dc:creator>
    <dc:date>2021-09-29T16:32:13Z</dc:date>
    <item>
      <title>reading a .txt file , searching for a specific string  doesn't work properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771009#M244601</link>
      <description>&lt;P&gt;Hello Team ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;am trying to read the below Out_test.txt file&amp;nbsp; and trying to read the highlighted text in the file with below code&lt;/P&gt;
&lt;P&gt;Out_test.txt :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;entry xml:base="http://Test.sas.api"
xmlns="http://www.w3.org/2005/Atom"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:georss="http://www.georss.org/georss"
xmlns:gml="http://www.opengis.net/gml"&amp;gt;
&amp;lt;id&amp;gt;//Test.sas.api('/iapps/SAR/files/163... new test file €.log')&amp;lt;/id&amp;gt;
&amp;lt;category term="SP.File" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /&amp;gt;
&amp;lt;link rel="edit" href="Web/GetFileByServerRelativeUrl('/iapps/SAR/files/mynewfile%20%20new%20test%20file%20%E2%82%AC.log')" /&amp;gt;
&amp;lt;link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Author" type="application/atom+xml;type=entry" title="Author" href="Web/GetFileByServerRelativeUrl('/iapps/SAR/files/1632849929_mynewfile%20%20new%20test%20file%20%E2%82%AC.log')/Auth
&amp;lt;link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CheckedOutByUser" type="application/atom+xml;type=entry" title="CheckedOutByUser" href="Web/GetFileByServerRelativeUrl('/iapps/SAR/files/mynewfile%20%20new%20test%20file%20%E2%82%AC.l
&amp;lt;title /&amp;gt;
&amp;lt;updated&amp;gt;2021-09-28T17:32:50Z&amp;lt;/updated&amp;gt;
&amp;lt;author&amp;gt;
&amp;lt;name /&amp;gt;
&amp;lt;/author&amp;gt;
&amp;lt;content type="application/xml"&amp;gt;
&amp;lt;m:properties&amp;gt;
&amp;lt;d:CheckInComment&amp;gt;&amp;lt;/d:CheckInComment&amp;gt;
&amp;lt;d:CheckOutType &amp;gt;2&amp;lt;/d:CheckOutType&amp;gt;
&amp;lt;d:UIVersionLabel&amp;gt;1.0&amp;lt;/d:UIVersionLabel&amp;gt;
&amp;lt;/m:properties&amp;gt;
&amp;lt;/content&amp;gt;
&amp;lt;/entry&amp;gt;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;code :&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Test_out_href;
length text $32767;
infile "/home/out_test.txt";
input;
text=scan(substr(_infile_, index(_infile_,"href")+37),1,"')");
call symputx("ServerRelativeUrl_new", text);
run;
%put this is to test &amp;amp;ServerRelativeUrl_new.
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: 1 record was read from the infile "/home/out_test.txt".&lt;BR /&gt;The minimum record length was 3511.&lt;BR /&gt;The maximum record length was 3511.&lt;BR /&gt;NOTE: The data set WORK.TEST_OUT_HREF has 1 observations and 1 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.TEST_OUT_HREF increased size by 100.00 percent. &lt;BR /&gt;Compressed is 2 pages; un-compressed would require 1 pages.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;user cpu time 0.01 seconds&lt;BR /&gt;system cpu time 0.00 seconds&lt;BR /&gt;memory 1071.40k&lt;BR /&gt;OS Memory 24492.00k&lt;BR /&gt;Timestamp 09/28/2021 10:22:44 PM&lt;BR /&gt;Step Count 55 Switch Count 2&lt;BR /&gt;Page Faults 0&lt;BR /&gt;Page Reclaims 165&lt;BR /&gt;Page Swaps 0&lt;BR /&gt;2 The SAS System Tuesday, September 28, 2021 07:05:00 PM&lt;/P&gt;
&lt;P&gt;Voluntary Context Switches 23&lt;BR /&gt;Involuntary Context Switches 0&lt;BR /&gt;Block Input Operations 0&lt;BR /&gt;Block Output Operations 528&lt;/P&gt;
&lt;P&gt;33 %put this is to test &amp;amp;ServerRelativeUrl_new.&lt;BR /&gt;34 &lt;BR /&gt;35 &lt;BR /&gt;36 GOPTIONS NOACCESSIBLE;&lt;BR /&gt;WARNING: Apparent invocation of macro E2 not resolved.&lt;BR /&gt;WARNING: Apparent invocation of macro AC not resolved.&lt;BR /&gt;this is to test &lt;FONT color="#FF0000"&gt;/iapps/SAR/files/mynewfile%20%20new%20test%20file%20%E2%82%AC.log.log&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;extra text ".log" is appended to the macro variable , Can i know reason behind it .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in my code , am trying to search the first occurance of href in the file and get the text after 37 characters till ) parenthesis.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;text=scan(substr(_infile_, index(_infile_,"href")+37),1,"')");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 07:31:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771009#M244601</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2021-09-29T07:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: reading a .txt file , searching for a specific string  doesn't work properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771027#M244610</link>
      <description>&lt;P&gt;Hint: if you want us to play with reading text please post the text into a TEXT box opened on the forum with the the &amp;lt;/&amp;gt; icon that appears above the message window. The main message windows on this forum reformat text when pasted such as inserting html tags and removing spaces. End of line characters may also get messed with.&lt;/P&gt;
&lt;P&gt;So there is almost no chance that what you posted in your question is actually the same as your source text file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First thing, I would make sure that HREF is actually in the string before using it for anything. Also, If the input file gets treated as having more than one line you would be overwriting your macro variable with a bad value for TEXT as you call symputx unconditionally and would be replaced with each line of input leaving the value as whatever came from the last line of data when href is on the line. You do have href appear more than once in that information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would trouble shoot this to some extent by reading the data in one step assigning the value of _infile_ to a variable. Then use another data step to parse and extract the desired text. Then I can see what the value of _infile_ actually is to diagnose issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also suggest finding some way to identify the line you want so that the search for "href" only happens where you actually want it to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 21:39:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771027#M244610</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-09-28T21:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: reading a .txt file , searching for a specific string  doesn't work properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771040#M244617</link>
      <description>&lt;P&gt;Why is there no semicolon after the %put statement?&lt;/P&gt;
&lt;P&gt;What's in the data set variable?&lt;/P&gt;
&lt;P&gt;Also this is more robust:&lt;/P&gt;
&lt;P&gt;TEXT=scan( substr(_infile_, index(_infile_,"href")), 2, "(')" );&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 22:43:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771040#M244617</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-09-28T22:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: reading a .txt file , searching for a specific string  doesn't work properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771085#M244639</link>
      <description>&lt;P&gt;Thanks , this works similar way&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Code : 

 data Test_out;
 length text2 $32767;
 infile "/home/out_test.txt";
  input;
  TEXT2=scan( substr(_infile_, index(_infile_,"href")), 2, "(')" );
   put    'this is to test inside data step ' TEXT2;
   call symputx("ServerRelativeUrl_new", strip(TEXT2));
   run;

   %put this is to test out side  &amp;amp;ServerRelativeUrl_new. ;

Log : 


this is to test inside data step &lt;FONT color="#FF00FF"&gt;/iapps/SAR/files/Mytestfile_%20%20new%20test%20file%20%E2%82%AC.txt&lt;/FONT&gt;
NOTE: 1 record was read from the infile "/home/b723166/out_test.txt".
The minimum record length was 3511.
The maximum record length was 3511.
NOTE: The data set WORK.TEST_OUT has 1 observations and 1 variables.
NOTE: Compressing data set WORK.TEST_OUT increased size by 100.00 percent.
Compressed is 2 pages; un-compressed would require 1 pages.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 1092.56k
OS Memory 21164.00k
Timestamp 09/29/2021 11:00:56 AM
Step Count 11 Switch Count 2
2 The SAS System Wednesday, September 29, 2021 10:48:00 AM

Page Faults 0
Page Reclaims 181
Page Swaps 0
Voluntary Context Switches 18
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 528

35
36 %put this is to test out side &amp;amp;ServerRelativeUrl_new.
37
38 GOPTIONS NOACCESSIBLE;
WARNING: Apparent invocation of macro E2 not resolved.
WARNING: Apparent invocation of macro AC not resolved.
this is to test out side &lt;FONT color="#000000"&gt;/iapps/SAR/files/Mytestfile_%20%20new%20test%20file%20%E2%82%AC.txt&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;.txt&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;The variable inside the data step works fine , but when we are using the variable outside of datastep it added with extra text like below&amp;nbsp; &lt;FONT color="#000000"&gt;/iapps/SAR/files/Mytestfile_%20%20new%20test%20file%20%E2%82%AC.txt&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;.txt&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please suggest some hints to fix this.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 08:06:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771085#M244639</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2021-09-29T08:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: reading a .txt file , searching for a specific string  doesn't work properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771089#M244640</link>
      <description>&lt;PRE&gt; This also results similar way 

 data Test_out;
  %let TEXT2='/iapps/SAR/files/mytestfile_%20%20new%20test%20file%20%E2%82%AC.txt';
   put    'this is to test inside data step ' &amp;amp;TEXT2;
   call symputx("ServerRelativeUrl_new2", strip(&amp;amp;TEXT2));
   run;
   %put this is to test out side  &amp;amp;ServerRelativeUrl_new2.

log : 

NOTE: Compression was disabled for data set WORK.TEST_OUT because compression overhead would increase the size of the data set.
this is to test inside data step /iapps/SAR/files/mytestfile_%20%20new%20test%20file%20%E2%82%AC.txt
NOTE: The data set WORK.TEST_OUT has 1 observations and 0 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              394.18k
      OS Memory           20388.00k
      Timestamp           09/29/2021 11:18:11 AM
      Step Count                        16  Switch Count  2
      Page Faults                       0
      Page Reclaims                     55
      Page Swaps                        0
      Voluntary Context Switches        15
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           136
      

31         
32            %put this is to test out side  &amp;amp;ServerRelativeUrl_new2.
33         
34         GOPTIONS NOACCESSIBLE;
WARNING: Apparent invocation of macro E2 not resolved.
WARNING: Apparent invocation of macro AC not resolved.
2                                                          The SAS System                  Wednesday, September 29, 2021 10:48:00 AM

this is to test out side  /iapps/SAR/files/mytestfile_%20%20new%20test%20file%20%E2%82%AC.&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;txt.txt&lt;/STRONG&gt; &lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Sep 2021 08:20:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771089#M244640</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2021-09-29T08:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: reading a .txt file , searching for a specific string  doesn't work properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771093#M244643</link>
      <description>&lt;P&gt;Here's a suggestion to test.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%put _user_;

%put text is &amp;amp;ServerRelativeUrl_new.      ;
%put;&lt;/PRE&gt;
&lt;P&gt;The _user_ says show all the user defined macro variables. Hopefully you haven't generated many in the current session. Note that the _user_ line does not generate the warning about the macro invocation and does not show the extra .log.&lt;/P&gt;
&lt;P&gt;Then the second put does have the warning &lt;STRONG&gt;and&lt;/STRONG&gt; shows the extra .log. Think there might be a connection?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you are running into one of the macro resolution rules involving the dot character. Run this and you can see that the . immediately following an "apparent invocation of macro" duplicates text.&lt;/P&gt;
&lt;PRE&gt;data _null_;
   x='text %be.abc';
   call symputx('xtest',x);
   y='text %be abc';
   call symputx('ytest',y);
run;

%put Xtest is: &amp;amp;xtest.    Ytest is: &amp;amp;ytest. ;&lt;/PRE&gt;
&lt;P&gt;I don't have a suggestion that will work right now if you really want the %E2 and %AC characters since this is happening a macro resolution time, not at assignment or creation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 09:34:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771093#M244643</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-09-29T09:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: reading a .txt file , searching for a specific string  doesn't work properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771103#M244647</link>
      <description>Thanks  for tips , I Agree with exactly in this example also The macro variable X resolves  to duplicate text&lt;BR /&gt;&lt;BR /&gt;Xtest is: text %be.abc.abc &lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; how to fix this duplication of text ,</description>
      <pubDate>Wed, 29 Sep 2021 10:25:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771103#M244647</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2021-09-29T10:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: reading a .txt file , searching for a specific string  doesn't work properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771104#M244648</link>
      <description>&lt;P&gt;Welcome to the wonderful world of blanks and special characters in filenames.&lt;/P&gt;
&lt;P&gt;(sarcasm intended)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This causes the XML to use %xx sequences to encode the special characters (hex E282AC is the Euro symbol in UTF-8), which in turn causes a hickup by the SAS macro processor. The blanks (encoded as %20) do not cause a problem because 20 can't be a macro name.&lt;/P&gt;
&lt;P&gt;Note that this only happens in the %PUT, the macro variable is correct:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Test_out_href;
length text $32767;
input;
text=scan(substr(_infile_, index(_infile_,"href")+37),1,"')");
call symputx("ServerRelativeUrl_new", text);
datalines;
&amp;lt;link rel="edit" href="Web/GetFileByServerRelativeUrl('/iapps/SAR/files/mynewfile%20%20new%20test%20file%20%E2%82%AC.log')" /&amp;gt;
;
%put this is to test &amp;amp;ServerRelativeUrl_new.;

data check;
text = symget("ServerRelativeUrl_new");
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;"log" is not duplicated when the contents of the macro variable are retrieved with SYMGET and the macro processor itself does not need to intervene.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 10:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771104#M244648</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-09-29T10:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: reading a .txt file , searching for a specific string  doesn't work properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771168#M244678</link>
      <description>&lt;P&gt;Thanks Kurt , Agree that this issue is caused by special characters like '%' , in the variable. SYMGET&amp;nbsp; helps in some situations but we cannot use functions like SYMGET when we are passing as a input variable to macro's.&amp;nbsp;we like to use the string with special characters in a variable in several places of code like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example we can’t use SYMGET to pass to macro’s like below , which inturn results an error.&lt;/P&gt;
&lt;P&gt;%Test_macro (url=%sysfunc(symget(ServerRelativeUrl_new))&amp;nbsp; &amp;nbsp;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put is just to test the value of the variable , but we need to use the URL variable in different places . is there any way to deal with this issue.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 16:32:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771168#M244678</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2021-09-29T16:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: reading a .txt file , searching for a specific string  doesn't work properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771176#M244679</link>
      <description>&lt;P&gt;I think the extra extension is a bug in the error message.&lt;/P&gt;
&lt;P&gt;But you need to add some macro quoting because of the strange text you are including in the value. Otherwise things like %AC are going to look like a macro call to the macro processor.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let ServerRelativeUrl_new=%superq(ServerRelativeUrl_new);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;188   data _null_;
189     text='/iapps/SAR/files/Mytestfile_%20%20new%20test%20file%20%E2%82%AC.txt';
190     call symputx("ServerRelativeUrl_new",text);
191   run;

NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


192
WARNING: Apparent invocation of macro E2 not resolved.
193   %put &amp;amp;=ServerRelativeUrl_new;
WARNING: Apparent invocation of macro AC not resolved.
SERVERRELATIVEURL_NEW=/iapps/SAR/files/Mytestfile_%20%20new%20test%20file%20%E2%82%AC.txt.txt
194   %let ServerRelativeUrl_new=%superq(ServerRelativeUrl_new);
195   %put &amp;amp;=ServerRelativeUrl_new;
SERVERRELATIVEURL_NEW=/iapps/SAR/files/Mytestfile_%20%20new%20test%20file%20%E2%82%AC.txt
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you need to convert those %20 things back into the characters they mean?&lt;/P&gt;
&lt;PRE&gt;196   data _null_;
197     text='/iapps/SAR/files/Mytestfile_%20%20new%20test%20file%20%E2%82%AC.txt';
198     call symputx("ServerRelativeUrl_new",urldecode(text));
199   run;

NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


200
201   %put &amp;amp;=ServerRelativeUrl_new;
SERVERRELATIVEURL_NEW=/iapps/SAR/files/Mytestfile_  new test file â‚¬.txt
202   %let ServerRelativeUrl_new=%superq(ServerRelativeUrl_new);
203   %put &amp;amp;=ServerRelativeUrl_new;
SERVERRELATIVEURL_NEW=/iapps/SAR/files/Mytestfile_  new test file â‚¬.txt
&lt;/PRE&gt;
&lt;P&gt;Are you perhaps running using UTF-8?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64231i868C218AA272D2B6/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 16:48:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771176#M244679</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-09-29T16:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: reading a .txt file , searching for a specific string  doesn't work properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771317#M244733</link>
      <description>&lt;P&gt;Thanks every one for valuable&amp;nbsp;inputs , with %superq the value works as expected&lt;/P&gt;
&lt;PRE&gt;   data _null_;
     text='/Eapps/SAR/files/Mytestfile_%20%20new%20test%20file%20%E2%82%AC.txt';
     call symputx("ServerRelativeUrl_new",text);
   run;
  

   %put &amp;amp;ServerRelativeUrl_new  and the other value is %superq(ServerRelativeUrl_new);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 07:34:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-a-txt-file-searching-for-a-specific-string-doesn-t-work/m-p/771317#M244733</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2021-09-30T07:34:55Z</dc:date>
    </item>
  </channel>
</rss>

