Hello Team ,
am trying to read the below Out_test.txt file and trying to read the highlighted text in the file with below code
Out_test.txt :
<?xml version="1.0" encoding="utf-8"?>
<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">
<id>//Test.sas.api('/iapps/SAR/files/163... new test file €.log')</id>
<category term="SP.File" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" href="Web/GetFileByServerRelativeUrl('/iapps/SAR/files/mynewfile%20%20new%20test%20file%20%E2%82%AC.log')" />
<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
<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
<title />
<updated>2021-09-28T17:32:50Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:CheckInComment></d:CheckInComment>
<d:CheckOutType >2</d:CheckOutType>
<d:UIVersionLabel>1.0</d:UIVersionLabel>
</m:properties>
</content>
</entry>
code :
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 &ServerRelativeUrl_new.
Log :
NOTE: 1 record was read from the infile "/home/out_test.txt". The minimum record length was 3511. The maximum record length was 3511. NOTE: The data set WORK.TEST_OUT_HREF has 1 observations and 1 variables. NOTE: Compressing data set WORK.TEST_OUT_HREF 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.01 seconds system cpu time 0.00 seconds memory 1071.40k OS Memory 24492.00k Timestamp 09/28/2021 10:22:44 PM Step Count 55 Switch Count 2 Page Faults 0 Page Reclaims 165 Page Swaps 0 2 The SAS System Tuesday, September 28, 2021 07:05:00 PM
Voluntary Context Switches 23 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 528
33 %put this is to test &ServerRelativeUrl_new. 34 35 36 GOPTIONS NOACCESSIBLE; WARNING: Apparent invocation of macro E2 not resolved. WARNING: Apparent invocation of macro AC not resolved. this is to test /iapps/SAR/files/mynewfile%20%20new%20test%20file%20%E2%82%AC.log.log
extra text ".log" is appended to the macro variable , Can i know reason behind it .
in my code , am trying to search the first occurance of href in the file and get the text after 37 characters till ) parenthesis.
text=scan(substr(_infile_, index(_infile_,"href")+37),1,"')");
... View more