<?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: Display age range &amp;amp; special character '$$$' in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298876#M62914</link>
    <description>&lt;P&gt;Why do you think that you need a macro?&lt;/P&gt;
&lt;P&gt;This is a perfect use case for a user defined format (see PROC FORMAT in the doc).&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2016 07:48:50 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2016-09-16T07:48:50Z</dc:date>
    <item>
      <title>Display  range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298874#M62913</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;it can take&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;parameters to accept the low-range and high-range and see if the value is within the range then display the exact range but if the value is less than or greater than the range then display '$$$'. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;how do i make this code generic... can u please suggest a solution.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt; &lt;BR /&gt;%macro check (dsn=, dsn2=);&lt;BR /&gt;data &amp;amp;dsn;&lt;BR /&gt;set &amp;amp;indsn (Keep=Age);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc format;&lt;BR /&gt; value band 10 - &amp;lt;12 = '11 - 12'&lt;BR /&gt; other = '$$$';&lt;BR /&gt;run; &lt;BR /&gt;&lt;BR /&gt;proc print data= &amp;amp;dsn;&lt;BR /&gt;format age band.;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;%mend check;&lt;BR /&gt;%check (dsn=, dsn2=); &lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2016 13:55:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298874#M62913</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2016-09-21T13:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: Display age range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298876#M62914</link>
      <description>&lt;P&gt;Why do you think that you need a macro?&lt;/P&gt;
&lt;P&gt;This is a perfect use case for a user defined format (see PROC FORMAT in the doc).&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2016 07:48:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298876#M62914</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-09-16T07:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Display age range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298877#M62915</link>
      <description>&lt;P&gt;i have huge data so need a generic macro to code so asking help to code it in a macro.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2016 07:55:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298877#M62915</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2016-09-16T07:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Display age range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298878#M62916</link>
      <description>&lt;P&gt;That statement makes no sense to me, why would a macro be more efficient than a format?&lt;/P&gt;
&lt;P&gt;Perhaps you need to describe your constraints and requirements&amp;nbsp;in more detail.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2016 08:01:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298878#M62916</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-09-16T08:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Display age range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298879#M62917</link>
      <description>sorry i mean to say i need a macro to code age values if the age value is between the ranges then display the range if the age value is out of range then display $$$.</description>
      <pubDate>Fri, 16 Sep 2016 08:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298879#M62917</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2016-09-16T08:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Display age range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298880#M62918</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH﻿&lt;/a&gt;&amp;nbsp;has said, there is no need for macro, macro language is for generating Base SAS code - it is not code in itself. &amp;nbsp;There is nothing at all in your post to indicate the need for generated code, it is a very basic logic gate scenario:&lt;/P&gt;
&lt;P&gt;result=ifc(12 &amp;lt;= age &amp;lt;= 15,"12-15","$$$");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively you can use formats as suggested, however personally with the whole 32/64 debacle I avoid any form of proprietary compiled file where at all possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another alternative is to have a dataset containing your values and merge that on, if there are a lot of them.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2016 08:12:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298880#M62918</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-09-16T08:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: Display age range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298900#M62932</link>
      <description>a merge is kinda difficult against a range, isn't it?</description>
      <pubDate>Fri, 16 Sep 2016 09:51:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298900#M62932</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2016-09-16T09:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: Display age range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298903#M62934</link>
      <description>&lt;P&gt;Simple as any other merge, example:&lt;/P&gt;
&lt;PRE&gt;data ranges;
  low=12; high=15; result="12-15";
run;

data have;
  age=10; output;
  age=14; output;
run;

proc sql;
  create table WANT as 
  select  A.*,
          COALESCE(B.RESULT,"$$$") as RESULT
  from    HAVE A
  left join RANGES B
  on      B.LOW &amp;lt;= A.AGE &amp;lt;= B.HIGH;
quit;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Sep 2016 10:04:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298903#M62934</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-09-16T10:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Display age range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298904#M62935</link>
      <description>aaah - a join is ok</description>
      <pubDate>Fri, 16 Sep 2016 10:09:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298904#M62935</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2016-09-16T10:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: Display age range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298919#M62941</link>
      <description>&lt;P&gt;Proc format;&lt;/P&gt;
&lt;P&gt;valie age_fmt&lt;/P&gt;
&lt;P&gt;12 -15 = '12-15'&lt;/P&gt;
&lt;P&gt;other = $$$';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;age15 = put(age, age_fmt.);&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2016 12:14:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298919#M62941</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-16T12:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Display age range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298933#M62943</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt; above i have posted my code but i want to make this code a generic code so that it can take&amp;nbsp;parameters to accept the low range and high range and see if the value is within the range then display the exact range but if the value is less than or greater than the range then display '$$$'. how do i make this code generic... can u please suggest a solution.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2016 13:41:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298933#M62943</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2016-09-16T13:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Display age range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298945#M62945</link>
      <description>&lt;P&gt;If you are taking parameters for the macro then why didn't you show them in your macro.&lt;/P&gt;
&lt;P&gt;Also the way&amp;nbsp; you have constructed this format, even as an example&lt;BR /&gt;&lt;FONT face="Courier New"&gt;proc format;&lt;BR /&gt; value Numericband &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;1&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;0 - &amp;lt;12 = '11 - 12'&lt;BR /&gt; 15 - &amp;lt;25 = '16 - 21'&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;(why do you&amp;nbsp;confuse 25 and 21 here by the way)&lt;/STRONG&gt;&lt;BR /&gt; other = '***';&lt;BR /&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;actually has &lt;STRONG&gt;2&lt;/STRONG&gt; ranges. So if you give a single&amp;nbsp;High and single&amp;nbsp;low value how do you construct 2 ranges?&lt;/P&gt;
&lt;P&gt;This is an example of creating a single range with a format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro numeric_band_check (indsn=, dsn=, low=, high=);
data &amp;amp;dsn;
set &amp;amp;indsn (Keep=Age);
run;

proc format;
 value Numericband 
 &amp;amp;low - &amp;lt; &amp;amp;high = "&amp;amp;low - &amp;amp;high"
 other = '***';
run; 

proc print data= &amp;amp;dsn;
format age Numericband.;
run;

%mend numeric_band_check;
%numeric_band_check (indsn=sashelp.class, dsn=test); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 14:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/298945#M62945</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-19T14:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Display age range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/299200#M63035</link>
      <description>@ballard thanks for the input but there another parameter variable= which is to be incorporated in the macro age shouldn't be hard coded how do it.</description>
      <pubDate>Mon, 19 Sep 2016 05:03:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/299200#M63035</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2016-09-19T05:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: Display age range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/299201#M63036</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60507"&gt;@RTelang﻿&lt;/a&gt;&amp;nbsp;playing 20 questions isn't efficient.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do you plan to pass/generate these boundaries? Is this an attempt at creating indicator variables?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 05:22:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/299201#M63036</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-19T05:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Display age range &amp; special character '$$$'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/299299#M63077</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60507"&gt;@RTelang&lt;/a&gt; wrote:&lt;BR /&gt;@ballard thanks for the input but there another parameter variable= which is to be incorporated in the macro age shouldn't be hard coded how do it.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It looks like time to read up the documtentation on parameters. If you have a parameter for your input data set, output and see how to use that then why is it difficult to pick your paramenter name and use it where AGE is currently in the code?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 14:44:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Display-range-amp-special-character/m-p/299299#M63077</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-19T14:44:00Z</dc:date>
    </item>
  </channel>
</rss>

