<?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: Replacing text within my _CLIENTPROJECTPATH macro output ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replacing-text-within-my-CLIENTPROJECTPATH-macro-output/m-p/727712#M226398</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/360343"&gt;@ctisseuil&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm a SAS GE user. I'd like to change my client project path, by replacing a piece of text and store the result as a macro variable.&amp;nbsp;Concretely:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My project directory path returned by `_CLIENTPROJECTPATH`&amp;nbsp; is&amp;nbsp; "R:\DMCD\MARK\project-file.egp".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to be replace&amp;nbsp; "R:\"&amp;nbsp; by "\\srvfic4\DDOC\" and remove the ending text "project-file.egp".&lt;/P&gt;
&lt;P&gt;I expect the final result to be stored as a macro variable, DIR_PROJ, containing the following path :&amp;nbsp; "\\srvfic4\DDOC\DMCD\MARK"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the piece of code that I have tried, but with no success:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let DIR_PROJ=tranwrd(&amp;amp;_CLIENTPROJECTPATH,'R:\', '\\srvfic4\DDOC');
%put &amp;amp;DIR_PROJ;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;To use data step functions such as TRANWRD in macro code you have to wrap the call in %sysfunc () for &lt;STRONG&gt;each&lt;/STRONG&gt; function to tell the processor that you want it applied.&lt;/P&gt;
&lt;P&gt;With the macro processor you don't use the quotes as they will be part of the value.&lt;/P&gt;
&lt;PRE&gt;%let _CLIENTPROJECTPATH=R:\DMCD\MARK\project-file.egp;

%let DIR_PROJ=%sysfunc(tranwrd(&amp;amp;_CLIENTPROJECTPATH.,R:\,\\srvfic4\DDOC));
%put &amp;amp;DIR_PROJ;&lt;/PRE&gt;
&lt;P&gt;Caution with just any characters in the macro language, since &amp;amp; and % have meaning to the macro processor you may have to use functions to mask the them if you need to use them in a string function as a literal value. You have been warned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not entirely clear when you just wanted to extract the path for the result or modify the path and still point to the same named file. I interpreted the request as the later.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Mar 2021 09:56:07 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-03-19T09:56:07Z</dc:date>
    <item>
      <title>Replacing text within my _CLIENTPROJECTPATH macro output ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-text-within-my-CLIENTPROJECTPATH-macro-output/m-p/727693#M226388</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a SAS GE user. I'd like to change my client project path, by replacing a piece of text and store the result as a macro variable.&amp;nbsp;Concretely:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My project directory path returned by `_CLIENTPROJECTPATH`&amp;nbsp; is&amp;nbsp; "R:\DMCD\MARK\project-file.egp".&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to be replace&amp;nbsp; "R:\"&amp;nbsp; by "\\srvfic4\DDOC\" and remove the ending text "project-file.egp".&lt;/P&gt;&lt;P&gt;I expect the final result to be stored as a macro variable, DIR_PROJ, containing the following path :&amp;nbsp; "\\srvfic4\DDOC\DMCD\MARK"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the piece of code that I have tried, but with no success:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%let DIR_PROJ=tranwrd(&amp;amp;_CLIENTPROJECTPATH,'R:\', '\\srvfic4\DDOC');
%put &amp;amp;DIR_PROJ;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 08:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-text-within-my-CLIENTPROJECTPATH-macro-output/m-p/727693#M226388</guid>
      <dc:creator>ctisseuil</dc:creator>
      <dc:date>2021-03-19T08:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing text within my _CLIENTPROJECTPATH macro output ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-text-within-my-CLIENTPROJECTPATH-macro-output/m-p/727712#M226398</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/360343"&gt;@ctisseuil&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm a SAS GE user. I'd like to change my client project path, by replacing a piece of text and store the result as a macro variable.&amp;nbsp;Concretely:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My project directory path returned by `_CLIENTPROJECTPATH`&amp;nbsp; is&amp;nbsp; "R:\DMCD\MARK\project-file.egp".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to be replace&amp;nbsp; "R:\"&amp;nbsp; by "\\srvfic4\DDOC\" and remove the ending text "project-file.egp".&lt;/P&gt;
&lt;P&gt;I expect the final result to be stored as a macro variable, DIR_PROJ, containing the following path :&amp;nbsp; "\\srvfic4\DDOC\DMCD\MARK"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the piece of code that I have tried, but with no success:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let DIR_PROJ=tranwrd(&amp;amp;_CLIENTPROJECTPATH,'R:\', '\\srvfic4\DDOC');
%put &amp;amp;DIR_PROJ;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;To use data step functions such as TRANWRD in macro code you have to wrap the call in %sysfunc () for &lt;STRONG&gt;each&lt;/STRONG&gt; function to tell the processor that you want it applied.&lt;/P&gt;
&lt;P&gt;With the macro processor you don't use the quotes as they will be part of the value.&lt;/P&gt;
&lt;PRE&gt;%let _CLIENTPROJECTPATH=R:\DMCD\MARK\project-file.egp;

%let DIR_PROJ=%sysfunc(tranwrd(&amp;amp;_CLIENTPROJECTPATH.,R:\,\\srvfic4\DDOC));
%put &amp;amp;DIR_PROJ;&lt;/PRE&gt;
&lt;P&gt;Caution with just any characters in the macro language, since &amp;amp; and % have meaning to the macro processor you may have to use functions to mask the them if you need to use them in a string function as a literal value. You have been warned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not entirely clear when you just wanted to extract the path for the result or modify the path and still point to the same named file. I interpreted the request as the later.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 09:56:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-text-within-my-CLIENTPROJECTPATH-macro-output/m-p/727712#M226398</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-19T09:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing text within my _CLIENTPROJECTPATH macro output ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-text-within-my-CLIENTPROJECTPATH-macro-output/m-p/728679#M226718</link>
      <description>Thank you very much !&lt;BR /&gt;&lt;BR /&gt;It works wonderfully &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Have a good day</description>
      <pubDate>Wed, 24 Mar 2021 08:04:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-text-within-my-CLIENTPROJECTPATH-macro-output/m-p/728679#M226718</guid>
      <dc:creator>ctisseuil</dc:creator>
      <dc:date>2021-03-24T08:04:15Z</dc:date>
    </item>
  </channel>
</rss>

