<?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: long var with multiple delimiter in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438134#M28290</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1896"&gt;@sas_9&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;The following code works for the sample you've posted.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
  infile 'c:\temp\log-file.txt' truncover lrecl=1300;
  input ;

  length var1 $200 var2 $1000;
  retain _prxid 0;
  if _n_=1 then
    do;
      _prxid=prxparse('/^("[^"]*")\s*(.*-METAPASS[^"]*")$/oi');
    end;

  if prxmatch(_prxid,strip(_infile_)) then
    do;
      call prxposn(_prxid, 1, _pos, _len);
      var1=substrn(_infile_,_pos,_len);
      call prxposn(_prxid, 2, _pos, _len);
      var2=substrn(_infile_,_pos,_len);
    end;
  run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There aren't any end-of-line indicators in your sample data but not sure if this is just because you've only posted a single "record".&lt;/P&gt;
&lt;P&gt;Shouldn't you have any end-of-line indicators in your log file then reading the data would need to be a bit different (data stream).&lt;/P&gt;</description>
    <pubDate>Sat, 17 Feb 2018 08:51:21 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2018-02-17T08:51:21Z</dc:date>
    <item>
      <title>long var with multiple delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438089#M28278</link>
      <description>&lt;P&gt;how would I read two strangers&amp;nbsp;below as 2 separate variable?&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;"SAS Enterprise Guide_SASApp - Workspace Server_70784B87-149E-AE47-BCE0-B331CF4E6EFF"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"SAS Enterprise Guide_SASApp - Workspace Server_123456jsdjh-12rfg-grr-BCE0-DSLKFMLKDS" "/SAS/WORKSPACE/SERVER/DIR/WorkspaceServer.sh -noterminal -noxcmd -netencryptalgorithm AES -metaserver servername.com -metaport 123456 -metarepository Foundation -locale en_US -objectserver -objectserverparms ""delayconn sph=servername.com protocol=bridge 6.852563 4700 0 -1 0 0 1894 0 0 0 32 -1 0 0 0 515049 4 -1 "" "default" 9 1 "" "" 0 1441792 0 "" "" "" "" 0 "" 15 "" -1 "/userid" "" "" "" -1 "" "" 16 "" 1511905439 "" "" 0 0 -1 0 362496 "select[type == any] order[r15s:pg] " "" -1 "" -1 0 "" 0 0 "" 2508 "" 0 "" 0.000000 0.00 0.00 0.00 0.00 1 "servername.com"&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 22:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438089#M28278</guid>
      <dc:creator>sas_9</dc:creator>
      <dc:date>2018-02-16T22:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: long var with multiple delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438093#M28279</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1896"&gt;@sas_9&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;how would I read two strangers&amp;nbsp;below as 2 separate variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What is a "stranger" in this context?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 22:51:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438093#M28279</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-16T22:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: long var with multiple delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438100#M28280</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1896"&gt;@sas_9&lt;/a&gt;&amp;nbsp;How would your desired result look like?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 23:03:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438100#M28280</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-02-16T23:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: long var with multiple delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438107#M28282</link>
      <description>&lt;P&gt;so VARIABLE1 and VARIABLE2 should look like (2 variables with one observation)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;VARIABLE1&lt;/P&gt;
&lt;P&gt;"SAS Enterprise Guide_SASApp - Workspace Server_70784B87-149E-AE47-BCE0-B331CF4E6EFF"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;VARIABLE2&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"SAS Enterprise Guide_SASApp - Workspace Server_123456jsdjh-12rfg-grr-BCE0-DSLKFMLKDS" "/SAS/WORKSPACE/SERVER/DIR/WorkspaceServer.sh -noterminal -noxcmd -netencryptalgorithm AES -metaserver servername.com -metaport 123456 -metarepository Foundation -locale en_US -objectserver -objectserverparms ""delayconn sph=servername.com protocol=bridge 6.852563 4700 0 -1 0 0 1894 0 0 0 32 -1 0 0 0 515049 4 -1 "" "default" 9 1 "" "" 0 1441792 0 "" "" "" "" 0 "" 15 "" -1 "/userid" "" "" "" -1 "" "" 16 "" 1511905439 "" "" 0 0 -1 0 362496 "select[type == any] order[r15s&lt;IMG title="Smiley Tongue" class="emoticon emoticon-smileytongue" alt="Smiley Tongue" src="https://communities.sas.com/i/smilies/16x16_smiley-tongue.png" border="0" /&gt;g] " "" -1 "" -1 0 "" 0 0 "" 2508 "" 0 "" 0.000000 0.00 0.00 0.00 0.00 1 "servername.com"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you -&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 23:36:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438107#M28282</guid>
      <dc:creator>sas_9</dc:creator>
      <dc:date>2018-02-16T23:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: long var with multiple delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438112#M28284</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1896"&gt;@sas_9&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;It wouldn't be a problem to post code for the data you've provided. But is this a representative sample?&lt;/P&gt;
&lt;P&gt;Could we use an empty line as delimiter? Or the string &lt;EM&gt;"SAS Enterprise Guide&lt;/EM&gt;&amp;nbsp;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ideally attach a text file with some more sample data for us to better understand what we're dealing with.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 23:43:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438112#M28284</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-02-16T23:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: long var with multiple delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438113#M28285</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1896"&gt;@sas_9&lt;/a&gt;&amp;nbsp; Not knowing what you want to do but as this looks like log: Have you already checked out what the SAS Environment Manager could do for you?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 23:48:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438113#M28285</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-02-16T23:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: long var with multiple delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438128#M28287</link>
      <description>&lt;P&gt;Thanks Patrick - infect i am reading one log file which has user executed job details and in that file (each value is separated by space) there are two long strings which i want to represent appropriately (sample attached). File has character strings In quotation mark. However, here, first string contains all in one quotation mark but second string is really long string which contains multiple quotation mark + different sign in between (like - / '@', etc..) but all the time it ends with like -&amp;gt; -METAPASS&amp;nbsp; 74785249857DSJVBSDJHB"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not that familiar with SAS EVM but this would be a big plus for me whenever user stats require, Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Feb 2018 03:28:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438128#M28287</guid>
      <dc:creator>sas_9</dc:creator>
      <dc:date>2018-02-17T03:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: long var with multiple delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438134#M28290</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1896"&gt;@sas_9&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;The following code works for the sample you've posted.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
  infile 'c:\temp\log-file.txt' truncover lrecl=1300;
  input ;

  length var1 $200 var2 $1000;
  retain _prxid 0;
  if _n_=1 then
    do;
      _prxid=prxparse('/^("[^"]*")\s*(.*-METAPASS[^"]*")$/oi');
    end;

  if prxmatch(_prxid,strip(_infile_)) then
    do;
      call prxposn(_prxid, 1, _pos, _len);
      var1=substrn(_infile_,_pos,_len);
      call prxposn(_prxid, 2, _pos, _len);
      var2=substrn(_infile_,_pos,_len);
    end;
  run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There aren't any end-of-line indicators in your sample data but not sure if this is just because you've only posted a single "record".&lt;/P&gt;
&lt;P&gt;Shouldn't you have any end-of-line indicators in your log file then reading the data would need to be a bit different (data stream).&lt;/P&gt;</description>
      <pubDate>Sat, 17 Feb 2018 08:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438134#M28290</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-02-17T08:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: long var with multiple delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438168#M28295</link>
      <description>&lt;P&gt;Thanks Patrick. All lines in log file start with "JOB_&amp;lt;USERID&amp;gt;"&amp;nbsp;and ends with that huge string which has -METAPASS 86896JKJHGJUHVBHB (-METAPASS and encrypted password), so that is a start and end point for each record.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Feb 2018 16:30:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438168#M28295</guid>
      <dc:creator>sas_9</dc:creator>
      <dc:date>2018-02-17T16:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: long var with multiple delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438307#M28316</link>
      <description>&lt;P&gt;attaching full log file with 2 records as an example,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Feb 2018 22:55:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/long-var-with-multiple-delimiter/m-p/438307#M28316</guid>
      <dc:creator>sas_9</dc:creator>
      <dc:date>2018-02-18T22:55:25Z</dc:date>
    </item>
  </channel>
</rss>

