<?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 a string in global variable? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197421#M49338</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;customize&amp;nbsp; date format , you can get any form of date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;picture fmt&lt;/P&gt;&lt;P&gt; low-high='%0d.%0m.%Y_at_%0H_%0M' (datatype=datetime);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%let zeitstempel = %SYSFUNC(DATETIME(), fmt.);&lt;/P&gt;&lt;P&gt;%put &amp;amp;zeitstempel.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Mar 2015 13:35:30 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2015-03-09T13:35:30Z</dc:date>
    <item>
      <title>How to replace a string in global variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197414#M49331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would&amp;nbsp; like to use the export procedure in order to create an excel with a time stamp, but proc export does not like the :.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I define the global variable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let zeitstempel = %SYSFUNC(DATE(), DDMMYYP10._at_%SYSFUNC(TIME(),TIME5.);&lt;/P&gt;&lt;P&gt;%put &amp;amp;zeitstempel.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I try to replace the : by _&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let zs = %SYSFUNC(tranwrd(&amp;amp;zeitstempel.),":","_");&lt;/P&gt;&lt;P&gt;%put &amp;amp;zs.;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;This gets ignored by sas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do I need to add quotation marks and get rid of them later?&lt;/P&gt;&lt;P&gt;Is there another way to achiveIs this?&lt;/P&gt;&lt;P&gt;Is there maybe another time format that I can set in order to avoid my problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gregor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 11:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197414#M49331</guid>
      <dc:creator>Gregor</dc:creator>
      <dc:date>2015-03-09T11:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a string in global variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197415#M49332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would recommend against having dates/times in filenames.&amp;nbsp; For two reasons, time/date is not an easy thing to work with, and version control systems generally need the filename to stay the same.&amp;nbsp; &lt;/P&gt;&lt;P&gt;If you continue though, the below will switch : for _:&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput('DT',cats(put(date(),ddmmyyp10.),"_at_",tranwrd(put(time(),time5.),":","_")));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%put &amp;amp;DT.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Personally I wouldn't try to do this in %let statements.&amp;nbsp; If you have to deal with parameters then put them in a datastep and call symput/execute the required output.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 11:37:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197415#M49332</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-03-09T11:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a string in global variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197416#M49333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem is the quotes. In macro code everything is a character strings so you do not need to put quotes around strings to distinguish them from numbers or variable names.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff; font-size: 12pt;"&gt;%let zs = %SYSFUNC(tranwrd(&amp;amp;zeitstempel.),:,_));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Tom Abernathy&#xD;
Fixed missing right parenthesis.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 11:43:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197416#M49333</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-09T11:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a string in global variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197417#M49334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This works perfectly.&amp;nbsp; I need to export excels with time stamps for documentary reasons. The numbers I calculate here have an impact on the data I deliver to an external recipant.&lt;/P&gt;&lt;P&gt;Thanks a bunch.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 12:34:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197417#M49334</guid>
      <dc:creator>Gregor</dc:creator>
      <dc:date>2015-03-09T12:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a string in global variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197418#M49335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This leads to ERROR: Expect close parenthesis after macro function not found.&lt;/P&gt;&lt;P&gt;Thanks a lot, anyway.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 12:37:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197418#M49335</guid>
      <dc:creator>Gregor</dc:creator>
      <dc:date>2015-03-09T12:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a string in global variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197419#M49336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add the extra ) required because TRANWRD() function is wrapped inside of %SYSFUNC() call.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 12:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197419#M49336</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-09T12:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a string in global variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197420#M49337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;customize&amp;nbsp; date format , you can get any form of date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;picture fmt&lt;/P&gt;&lt;P&gt; low-high='%0d.%0m.%Y_at_%0H_%0M' (datatype=datetime);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%let zeitstempel = %SYSFUNC(DATETIME(), fmt.);&lt;/P&gt;&lt;P&gt;%put &amp;amp;zeitstempel.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 13:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197420#M49337</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-03-09T13:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a string in global variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197421#M49338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;customize&amp;nbsp; date format , you can get any form of date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;picture fmt&lt;/P&gt;&lt;P&gt; low-high='%0d.%0m.%Y_at_%0H_%0M' (datatype=datetime);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%let zeitstempel = %SYSFUNC(DATETIME(), fmt.);&lt;/P&gt;&lt;P&gt;%put &amp;amp;zeitstempel.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 13:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197421#M49338</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-03-09T13:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a string in global variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197422#M49339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;/*The above step won't work becoz you didnt mask the quotes..So see below*/&lt;/P&gt;&lt;P&gt;%let zs = %SYSFUNC(tranwrd(&amp;amp;zeitstempel.,%str(:),%str(_)));&lt;/P&gt;&lt;P&gt;%put &amp;amp;zs.;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 19:07:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197422#M49339</guid>
      <dc:creator>BOBSAS</dc:creator>
      <dc:date>2015-03-09T19:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a string in global variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197423#M49340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem is not that the quotes are not masked, but that the quotes are included in the string to find and so there is no match.&lt;/P&gt;&lt;P&gt;Also note that neither : or _ are macro triggers so there is no need to use %STR() to quote them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 21:00:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197423#M49340</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-09T21:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a string in global variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197424#M49341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah. Exactly... Thanks Tom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simply we can write as below,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%let zs = %SYSFUNC(tranwrd(&amp;amp;zeitstempel.:,_));&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%put &amp;amp;zs.; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 23:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-replace-a-string-in-global-variable/m-p/197424#M49341</guid>
      <dc:creator>BOBSAS</dc:creator>
      <dc:date>2015-03-09T23:50:18Z</dc:date>
    </item>
  </channel>
</rss>

