<?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 Format as a macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Format-as-a-macro-variable/m-p/77573#M16804</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to use format (for example best or numx) as a macro variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have conditions (if/else macro) when reading the data in. Macro reads arguments from .csv file with a comma or a dot in place of the decimal point. Depending on that I would like to use a comma or a dot in place of the decimal point in the output depending arguments separators (comma/dot). Any help will be apprecated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Jun 2012 05:47:21 GMT</pubDate>
    <dc:creator>exj</dc:creator>
    <dc:date>2012-06-07T05:47:21Z</dc:date>
    <item>
      <title>Format as a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-as-a-macro-variable/m-p/77573#M16804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to use format (for example best or numx) as a macro variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have conditions (if/else macro) when reading the data in. Macro reads arguments from .csv file with a comma or a dot in place of the decimal point. Depending on that I would like to use a comma or a dot in place of the decimal point in the output depending arguments separators (comma/dot). Any help will be apprecated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2012 05:47:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-as-a-macro-variable/m-p/77573#M16804</guid>
      <dc:creator>exj</dc:creator>
      <dc:date>2012-06-07T05:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Format as a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-as-a-macro-variable/m-p/77574#M16805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please provide the control date set you are using:&lt;/P&gt;&lt;P&gt;"Macro reads arguments from .csv file"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, you can use a format as the value of a macro variable.&lt;/P&gt;&lt;P&gt;%Let format = best;&lt;/P&gt;&lt;P&gt;The issue is whether you add a period to the end of the format:&lt;/P&gt;&lt;P&gt;%Let format = best.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can then use the macro variable in a SAS statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Var = put(Var,&amp;amp;Format);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without the dot as suffix you have to use TWO periods after the macro variable reference&lt;/P&gt;&lt;P&gt;1. to end the macro variable reference&lt;/P&gt;&lt;P&gt;2. to add the dot after the format name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Let format = best;&lt;/P&gt;&lt;P&gt;Var = put(Var,&amp;amp;Format..);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ron.Fehd.macro.maven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2012 16:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-as-a-macro-variable/m-p/77574#M16805</guid>
      <dc:creator>Ron_MacroMaven</dc:creator>
      <dc:date>2012-06-08T16:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Format as a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-as-a-macro-variable/m-p/77575#M16806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure I am understanding the question completely, but it sounds like you are asking how to read your input and determine whether to use a comma or dot in decimal place?&amp;nbsp;&amp;nbsp; You are reading values from different regions that use different punctuation characters when printing numbers?&amp;nbsp; For example they might have two and a half written as 2.5 or 2,5 ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you just need to determine this for the full file then you could scan the file once as text and make a decision on what to do.&amp;nbsp; Then either adjust the code or possible the LOCALE option setting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2012 22:48:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-as-a-macro-variable/m-p/77575#M16806</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-06-08T22:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: Format as a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-as-a-macro-variable/m-p/77576#M16807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;This should get you started:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data new;&lt;BR /&gt;input C $;&lt;BR /&gt;N=inputn(C, ifc(index(C,'.'), '32.', 'numx32.'));&lt;BR /&gt;put C= N= ;&lt;BR /&gt;cards;&lt;BR /&gt;224.5&lt;BR /&gt;556,4&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;C=224.5 N=224.5&lt;BR /&gt;C=556,4 N=556.4&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2012 02:48:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-as-a-macro-variable/m-p/77576#M16807</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2012-06-12T02:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Format as a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-as-a-macro-variable/m-p/77577#M16808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you all for your answers. I used call symput, for example I created macro variables with&lt;/P&gt;&lt;P&gt;call symput('separator',',');&lt;/P&gt;&lt;P&gt;call symput('printformat','numx15.5'); (format numx/best depends on whether a comma or dot in decimal place).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use separator as list separator as "&amp;amp;separator" and printformat as &amp;amp;printformat. (without quatation marks) when making the report in the end.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And again, thank you for hints and help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2012 10:06:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-as-a-macro-variable/m-p/77577#M16808</guid>
      <dc:creator>exj</dc:creator>
      <dc:date>2012-06-12T10:06:18Z</dc:date>
    </item>
  </channel>
</rss>

