<?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 user-defined format from a function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/user-defined-format-from-a-function/m-p/392523#M94476</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a simple way to make a format thar simply&amp;nbsp;concatinate two char variables?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data could be like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Organisation, status&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;GGGG, N&lt;/P&gt;&lt;P&gt;YYYY, N&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wish to use a format to the organisaton variable som I get this output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Organisaton, status&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;N GGGG,N&lt;/P&gt;&lt;P&gt;N YYYY,N&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternative set a constant value as a pre-fix on the organisation based on content in another variable.&lt;/P&gt;&lt;P&gt;Like this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CASE WHEN town=HH&lt;/P&gt;&lt;P&gt;THEN 'N'!!Organisation&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can construct the code in different ways&amp;nbsp;- &amp;nbsp;but i prefer to output the logic as a format so the original data not is changed and i do not need an extra column.&lt;/P&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;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Fri, 01 Sep 2017 13:10:31 GMT</pubDate>
    <dc:creator>ANLYNG</dc:creator>
    <dc:date>2017-09-01T13:10:31Z</dc:date>
    <item>
      <title>user-defined format from a function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/user-defined-format-from-a-function/m-p/392523#M94476</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a simple way to make a format thar simply&amp;nbsp;concatinate two char variables?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data could be like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Organisation, status&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;GGGG, N&lt;/P&gt;&lt;P&gt;YYYY, N&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wish to use a format to the organisaton variable som I get this output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Organisaton, status&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;N GGGG,N&lt;/P&gt;&lt;P&gt;N YYYY,N&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternative set a constant value as a pre-fix on the organisation based on content in another variable.&lt;/P&gt;&lt;P&gt;Like this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CASE WHEN town=HH&lt;/P&gt;&lt;P&gt;THEN 'N'!!Organisation&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can construct the code in different ways&amp;nbsp;- &amp;nbsp;but i prefer to output the logic as a format so the original data not is changed and i do not need an extra column.&lt;/P&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;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 13:10:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/user-defined-format-from-a-function/m-p/392523#M94476</guid>
      <dc:creator>ANLYNG</dc:creator>
      <dc:date>2017-09-01T13:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: user-defined format from a function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/user-defined-format-from-a-function/m-p/392554#M94487</link>
      <description>&lt;P&gt;Formats are associated with single variables, not multiple.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think that you may want to provide a little more detail or variability in your "example" as you have n in 4 different places so it isn't exactly clear which 'n' goes where.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to display 'GGGG' as a specific string that does not change then you could build a data set from your example values useing string concatenation functions so you have values like:&lt;/P&gt;
&lt;P&gt;Start&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label&lt;/P&gt;
&lt;P&gt;GGGG&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; abc GGGG&lt;/P&gt;
&lt;P&gt;YYYY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pd&amp;nbsp; YYYY&lt;/P&gt;
&lt;P&gt;and build a format from that data set. There are some other bits. But a format only assings one label text to any given value.&lt;/P&gt;
&lt;P&gt;You cannot have format assign abc GGGG one time and pd GGGG another time. That will require creating an actual additional variable with concatenation.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 14:32:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/user-defined-format-from-a-function/m-p/392554#M94487</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-01T14:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: user-defined format from a function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/user-defined-format-from-a-function/m-p/392568#M94491</link>
      <description>&lt;P&gt;The organisation coloums has huge amount af different content. so I need to put a constant string or combine with another coloumn dynamiccaly. I was thinlking about a function and create a format from that - but is not sure how to do it...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 14:56:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/user-defined-format-from-a-function/m-p/392568#M94491</guid>
      <dc:creator>ANLYNG</dc:creator>
      <dc:date>2017-09-01T14:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: user-defined format from a function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/user-defined-format-from-a-function/m-p/392577#M94494</link>
      <description>&lt;P&gt;A format will only associate with a &lt;FONT color="#ff0000"&gt;&lt;EM&gt;&lt;U&gt;&lt;STRONG&gt;single variable&lt;/STRONG&gt;&lt;/U&gt;&lt;/EM&gt;&lt;/FONT&gt;. And only assign one output value for a given input (barring use of multilabel formats in the very small number of procedures that recognize them). Even though you can use a user function in a format it may only use one variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In effect you are asking to do something like this:&lt;/P&gt;
&lt;PRE&gt;Proc format library=work;
value $junk
'GGGG' = 'abc GGGG'
'GGGG' = 'pd GGGG'
;
run;&lt;/PRE&gt;
&lt;P&gt;which will result in a repeated range error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;19   Proc format library=work;
20   value $junk
21   'GGGG' = 'abc GGGG'
22   'GGGG' = 'pd GGGG'
ERROR: This range is repeated, or values overlap: GGGG-GGGG.
23   ;
NOTE: The previous statement has been deleted.
24   run;
&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Sep 2017 15:25:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/user-defined-format-from-a-function/m-p/392577#M94494</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-01T15:25:31Z</dc:date>
    </item>
  </channel>
</rss>

