<?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: Unmask ')' bracket  from a string '%)' in a sas datastep in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611565#M178252</link>
    <description>&lt;P&gt;label_name =&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;99.5%&amp;nbsp; Value At Risk (Lifeup)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This value is causing the issue..'%' character&lt;/P&gt;</description>
    <pubDate>Fri, 13 Dec 2019 13:42:04 GMT</pubDate>
    <dc:creator>chithra</dc:creator>
    <dc:date>2019-12-13T13:42:04Z</dc:date>
    <item>
      <title>Unmask ')' bracket  from a string '%)' in a sas datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611271#M178129</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a program like below , which is to modify the labels of the datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select distinct quote(trim(memname)) into :mis_tables SEPARATED by ',' from sashelp.vcolumn&lt;BR /&gt;where libname='&lt;EM&gt;libref&lt;/EM&gt;';&lt;BR /&gt;quit;&lt;BR /&gt;%put &amp;amp;mis_tables;&lt;/P&gt;&lt;P&gt;options nomlogic nosymbolgen nomprint;&lt;/P&gt;&lt;P&gt;/* Updating the lables */&lt;BR /&gt;%macro s(kname1 ,kname2,labels );&lt;BR /&gt;%let labels2 = %sysfunc(tranwrd(%quote(&amp;amp;labels),%str(??),%str(,)));&lt;/P&gt;&lt;P&gt;proc datasets lib=resasdmc nodetails nolist ;&lt;BR /&gt;modify &amp;amp;kname1;&lt;BR /&gt;label &amp;amp;kname2="&amp;amp;labels2" ;&lt;BR /&gt;quit;&lt;BR /&gt;%mend s;&lt;/P&gt;&lt;P&gt;data ddd(keep=table_name tech_name label_name_1);&lt;BR /&gt;set mis_ref_labels; //oracle table&lt;BR /&gt;where table_name in (&amp;amp;mis_tables);&lt;BR /&gt;label_name_1= tranwrd (label_name,',','??');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;set ddd;&lt;BR /&gt;call execute('%nrstr(%s('||(strip(table_name))||' , '||(strip(tech_name))||','||%str(strip(label_name_1))||'))');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table ddd:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;TABLE_NAME&lt;/TD&gt;&lt;TD&gt;TECH_NAME&lt;/TD&gt;&lt;TD&gt;label_name_1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;MIS_FLAT_BUS_SEG_KPI&lt;/TD&gt;&lt;TD&gt;AMT0_AAE_N&lt;/TD&gt;&lt;TD&gt;Acq Cost And Admin Exp?? Net&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;MIS_FACT&lt;/TD&gt;&lt;TD&gt;AMT0_AAE_O&lt;/TD&gt;&lt;TD&gt;Acq Cost And Admin Exp?? Retro&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;MIS_FACT&lt;/TD&gt;&lt;TD&gt;AMT1_APR_N&lt;/TD&gt;&lt;TD&gt;Agg Pol Res?? Net&lt;/TD&gt;&lt;/TR&gt;&lt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M_PCT&lt;/TD&gt;&lt;TD&gt;Management Expense (%)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am gettign an error :&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: Expected close parenthesis after macro function invocation not found.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Rootcause : The last row, label_name1 column is having a value&amp;nbsp;&lt;STRONG&gt;Management Expense (%) &lt;/STRONG&gt;where the character '%)' is masking ')'., there by causes closing parenthesis issue.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Can anyone please help here?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thanks,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Chithra&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 12:32:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611271#M178129</guid>
      <dc:creator>chithra</dc:creator>
      <dc:date>2019-12-12T12:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Unmask ')' bracket  from a string '%)' in a sas datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611274#M178132</link>
      <description>&lt;P&gt;Why don't you put everything into the call execute:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ddd(keep=table_name tech_name label_name);
set mis_ref_labels; //oracle table
where table_name in (&amp;amp;mis_tables);
run;

data _null_;
set ddd;
call execute('
  proc datasets lib=resasdmc nodetails nolist;
  modify ' !! strip(table_name) !! ';
  label ' !! strip(tech_name) !!'="' !! strip(label_name) '";
  quit;
');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;Edit: removed the surplus quote, as found by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/54638"&gt;@chithra&lt;/a&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 13:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611274#M178132</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-12T13:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Unmask ')' bracket  from a string '%)' in a sas datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611279#M178136</link>
      <description>&lt;P&gt;will this solves the issue?&lt;/P&gt;&lt;P&gt;it is throwing erro for mw..quotes issue.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 12:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611279#M178136</guid>
      <dc:creator>chithra</dc:creator>
      <dc:date>2019-12-12T12:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: Unmask ')' bracket  from a string '%)' in a sas datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611280#M178137</link>
      <description>&lt;P&gt;it was a bracket issue in the code you provided..&lt;/P&gt;&lt;P&gt;corercted it now..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do you have any idea to increase the performance.&lt;/P&gt;&lt;P&gt;There are 4000 datasets.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 13:01:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611280#M178137</guid>
      <dc:creator>chithra</dc:creator>
      <dc:date>2019-12-12T13:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Unmask ')' bracket  from a string '%)' in a sas datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611285#M178140</link>
      <description>&lt;P&gt;You can modify the data step to execute only one proc datasets:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set ddd end=done;
by table_name;
if _n_ = 1 then call execute('
  proc datasets lib=resasdmc nodetails nolist;
');
if first.table_name then call execute('
  modify ' !! strip(table_name) !! ';
');
call execute('
  label ' !! strip(tech_name) !!'="' !! strip(label_name) '";
');
if done then call execute('quit;');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Dec 2019 13:16:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611285#M178140</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-12T13:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Unmask ')' bracket  from a string '%)' in a sas datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611544#M178243</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;And i am getting an error below :&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: The value '&amp;nbsp;'n is not a valid SAS name.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 10:29:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611544#M178243</guid>
      <dc:creator>chithra</dc:creator>
      <dc:date>2019-12-13T10:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Unmask ')' bracket  from a string '%)' in a sas datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611550#M178247</link>
      <description>&lt;P&gt;I guess you have an empty table_name or tech_name. Or some other "funny" value.&lt;/P&gt;
&lt;P&gt;Please post the log of the code lines that cause the value; just posting the message is not helpful.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 11:41:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611550#M178247</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-13T11:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Unmask ')' bracket  from a string '%)' in a sas datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611565#M178252</link>
      <description>&lt;P&gt;label_name =&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;99.5%&amp;nbsp; Value At Risk (Lifeup)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This value is causing the issue..'%' character&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 13:42:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611565#M178252</guid>
      <dc:creator>chithra</dc:creator>
      <dc:date>2019-12-13T13:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: Unmask ')' bracket  from a string '%)' in a sas datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611571#M178256</link>
      <description>&lt;P&gt;Better to use functions to insure that the generated code has valid syntax. Use NLITERAL() to handle gooty variable names. Use QUOTE() to quote the labels using single quotes to prevent any embedded macro triggers or quote characters from causing trouble.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ddd ;
  set mis_ref_labels(keep= table_name tech_name label_name) end=eof; 
  where table_name in (&amp;amp;mis_tables);
  by table_name ;
  if _n_=1 then call execute('proc datasets lib=resasdmc nolist;');
  if first.table_name then call execute(catx(' ','modify',nliteral(table_name),';'));
  call execute(catx(' ','label',nliteral(tech_name),'=',quote(trim(label_name),"'"),';'));
  if last.table_name then call execute('run;');
  if eof then call execute('quit;');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Dec 2019 14:14:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611571#M178256</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-13T14:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: Unmask ')' bracket  from a string '%)' in a sas datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611574#M178258</link>
      <description>&lt;P&gt;Many Thanks.&lt;/P&gt;&lt;P&gt;It is working now !&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 14:19:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unmask-bracket-from-a-string-in-a-sas-datastep/m-p/611574#M178258</guid>
      <dc:creator>chithra</dc:creator>
      <dc:date>2019-12-13T14:19:45Z</dc:date>
    </item>
  </channel>
</rss>

