<?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: apply format to comma separated values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/apply-format-to-comma-separated-values/m-p/130086#M26566</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Big thanks to PGstats !&lt;/P&gt;&lt;P&gt;found it with proc sql :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table test&lt;/P&gt;&lt;P&gt;&amp;nbsp; (germs char(100));&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; insert into test&lt;/P&gt;&lt;P&gt;&amp;nbsp; (germs)&lt;/P&gt;&lt;P&gt;&amp;nbsp; values("&lt;STRONG style="font-size: 16px; font-family: calibri, verdana, arial, sans-serif; background-color: #ffffff;"&gt;('BORPER','BRR_SP','CHL_PN')&lt;/STRONG&gt;");&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp; data _null_(keep=germs latinGerm);&lt;/P&gt;&lt;P&gt;&amp;nbsp; attrib latinGerm length=$100;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i = 1 by 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; word = scan(germs,i,"'() ,'");&lt;/P&gt;&lt;P&gt;&amp;nbsp; if missing(word) then leave;&lt;/P&gt;&lt;P&gt;&amp;nbsp; latinGerm = catx(" &amp;amp; ",latinGerm,cats("",put(word,&amp;amp;formatGerm.),""));&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /*latinGerm = cats('(',latinGerm,')');*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symputx ('displayGerms',latinGerm);&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put &amp;amp;displayGerms;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Mar 2013 10:52:32 GMT</pubDate>
    <dc:creator>mathias</dc:creator>
    <dc:date>2013-03-11T10:52:32Z</dc:date>
    <item>
      <title>apply format to comma separated values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/apply-format-to-comma-separated-values/m-p/130082#M26562</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 have a string (that comes from a multiple select in a stp)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;that looks like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;('BORPER','BRR_SP','CHL_PN')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I have a format for these 3 values (e.g. BORPER="Bordetella pertussis")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to apply my format to each value of my string rather than the whole string ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 15:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/apply-format-to-comma-separated-values/m-p/130082#M26562</guid>
      <dc:creator>mathias</dc:creator>
      <dc:date>2013-03-07T15:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: apply format to comma separated values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/apply-format-to-comma-separated-values/m-p/130083#M26563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something like this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;data test;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;attrib line length=$100;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;input line &amp;amp;;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;('BORPER','BRR_SP','CHL_PN')&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;proc Format;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;value $ myFormat&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "BORPER"="Bordetella pertussis"&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "BRR_SP"="Some sort of BRR"&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "CHL_PN"="What is CHL PN?"&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OTHER="Other species"&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt; ;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;data want(keep=line newline);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;attrib newLine length=$100;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;set test;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;do i = 1 by 1;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt; word = scan(line,i,"'(), ");&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt; if missing(word) then leave;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt; newLine = catx(",",newLine,cats("'",put(word,$myFormat.),"'"));&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt; end;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt; newLine = cats('(',newLine,')');&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 17:28:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/apply-format-to-comma-separated-values/m-p/130083#M26563</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-03-07T17:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: apply format to comma separated values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/apply-format-to-comma-separated-values/m-p/130084#M26564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Works great outside a macro, but how would you run this inside a macro (which does not accept datalines statements) ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 10:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/apply-format-to-comma-separated-values/m-p/130084#M26564</guid>
      <dc:creator>mathias</dc:creator>
      <dc:date>2013-03-11T10:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: apply format to comma separated values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/apply-format-to-comma-separated-values/m-p/130085#M26565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Huh?&amp;nbsp; &lt;/P&gt;&lt;P&gt;The data step was just there to setup an example dataset so that PG could post a working example.&lt;/P&gt;&lt;P&gt;What is the source of the string?&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If it is already in a dataset then process the dataset as PG suggests.&lt;/LI&gt;&lt;LI&gt;If it is in a macro variable then&lt;UL&gt;&lt;LI&gt;you could just replace his SET TEST line with LINE="&amp;amp;macrovarname" statement instead.&lt;/LI&gt;&lt;LI&gt;Or you could translate the data step into the equivalent statements in macro code use %SYSFUNC() &lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 10:30:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/apply-format-to-comma-separated-values/m-p/130085#M26565</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-03-11T10:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: apply format to comma separated values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/apply-format-to-comma-separated-values/m-p/130086#M26566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Big thanks to PGstats !&lt;/P&gt;&lt;P&gt;found it with proc sql :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table test&lt;/P&gt;&lt;P&gt;&amp;nbsp; (germs char(100));&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; insert into test&lt;/P&gt;&lt;P&gt;&amp;nbsp; (germs)&lt;/P&gt;&lt;P&gt;&amp;nbsp; values("&lt;STRONG style="font-size: 16px; font-family: calibri, verdana, arial, sans-serif; background-color: #ffffff;"&gt;('BORPER','BRR_SP','CHL_PN')&lt;/STRONG&gt;");&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp; data _null_(keep=germs latinGerm);&lt;/P&gt;&lt;P&gt;&amp;nbsp; attrib latinGerm length=$100;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i = 1 by 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; word = scan(germs,i,"'() ,'");&lt;/P&gt;&lt;P&gt;&amp;nbsp; if missing(word) then leave;&lt;/P&gt;&lt;P&gt;&amp;nbsp; latinGerm = catx(" &amp;amp; ",latinGerm,cats("",put(word,&amp;amp;formatGerm.),""));&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /*latinGerm = cats('(',latinGerm,')');*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symputx ('displayGerms',latinGerm);&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %put &amp;amp;displayGerms;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 10:52:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/apply-format-to-comma-separated-values/m-p/130086#M26566</guid>
      <dc:creator>mathias</dc:creator>
      <dc:date>2013-03-11T10:52:32Z</dc:date>
    </item>
  </channel>
</rss>

