<?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: Call the winsorization macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760189#M240359</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's perfectly fine to %INCLUDE the macro definition in order to compile it. I guess your &amp;amp;dir exists?&lt;/P&gt;
&lt;P&gt;You can do a&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;%PUT &amp;amp;=dir;&lt;/P&gt;
&lt;P&gt;to find out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No idea what has gone wrong. Maybe&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;can help you out.&lt;/P&gt;
&lt;P&gt;Calling out to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
    <pubDate>Sat, 07 Aug 2021 19:56:26 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2021-08-07T19:56:26Z</dc:date>
    <item>
      <title>Call the winsorization macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760182#M240354</link>
      <description>&lt;P&gt;I am trying to winsorize a variable using the winsorization macro provided by WRDS, which can be seen here:&amp;nbsp;&lt;A href="https://gist.github.com/mgao6767/736968d5b3a6b9c11df76624c98e5d50" target="_blank"&gt;https://gist.github.com/mgao6767/736968d5b3a6b9c11df76624c98e5d50&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I call the macro with&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%include "&amp;amp;dir\Code\winsorize.sas";
%winsorize(inset = have, outset = want, sortvar = region, vars = number, perc1 = 2.5, trim = 0);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and get error messages:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;WARNING: Apparent invocation of macro NWORDS not resolved.&lt;BR /&gt;### START.&lt;BR /&gt;### Winsorization&lt;BR /&gt;WARNING: Apparent invocation of macro NWORDS not resolved.&lt;BR /&gt;### Number of Variables: %nwords(flow)&lt;BR /&gt;### List of Variables: flow&lt;BR /&gt;### Sorting...&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The&lt;BR /&gt;condition was: 100-2.5&lt;BR /&gt;ERROR: The macro WINSORIZE will stop executing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Aug 2021 19:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760182#M240354</guid>
      <dc:creator>xyxu</dc:creator>
      <dc:date>2021-08-07T19:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Call the winsorization macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760184#M240355</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Probably you need to submit the&amp;nbsp;&lt;SPAN&gt;NWORDS macro definition&amp;nbsp;first (i.e. compiling the macro such that you can call it afterwards).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You should be able to find&amp;nbsp;the&amp;nbsp;NWORDS macro definition on the&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wharton Research Data Services (WRDS) website.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If not I can send it to you in a private mail.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The WRDS Macro NWORDS&lt;BR /&gt;counts the Number of Words Within a Text String&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;and was written by&amp;nbsp;Mark Keintz, WRDS (also active on these communities).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Koen&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Aug 2021 19:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760184#M240355</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-08-07T19:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Call the winsorization macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760186#M240356</link>
      <description>&lt;P&gt;Thanks! Perhaps the way I use these macros is wrong. Here is how I tried to compile them:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%include "&amp;amp;dir\Code\nwords.sas";
%include "&amp;amp;dir\Code\winsorize.sas";
%winsorize(inset = have, outset = want, sortvar = region, vars = number, perc1 = 2.5, trim = 0);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now the messages are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;### START.&lt;BR /&gt;### Winsorization&lt;BR /&gt;### Number of Variables: 1&lt;BR /&gt;### List of Variables: number&lt;BR /&gt;### Sorting...&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The&lt;BR /&gt;condition was: 100-2.5&lt;BR /&gt;ERROR: The macro WINSORIZE will stop executing.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Aug 2021 19:46:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760186#M240356</guid>
      <dc:creator>xyxu</dc:creator>
      <dc:date>2021-08-07T19:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Call the winsorization macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760189#M240359</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's perfectly fine to %INCLUDE the macro definition in order to compile it. I guess your &amp;amp;dir exists?&lt;/P&gt;
&lt;P&gt;You can do a&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;%PUT &amp;amp;=dir;&lt;/P&gt;
&lt;P&gt;to find out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No idea what has gone wrong. Maybe&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;can help you out.&lt;/P&gt;
&lt;P&gt;Calling out to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Sat, 07 Aug 2021 19:56:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760189#M240359</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-08-07T19:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Call the winsorization macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760190#M240360</link>
      <description>Yes, my dir works. Not sure what causes the error here.</description>
      <pubDate>Sat, 07 Aug 2021 19:57:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760190#M240360</guid>
      <dc:creator>xyxu</dc:creator>
      <dc:date>2021-08-07T19:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Call the winsorization macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760191#M240361</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure about what that macro does, but you can also program the&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;Winsorized stuff yourself.&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL class="lia-list-style-type-square"&gt;
&lt;LI&gt;&lt;SPAN style="font-family: inherit;"&gt;Winsorized means are in PROC UNIVARIATE and in&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit;"&gt;PROC CAPABILITY (SAS/QC).&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI class="xisDoc-refProc"&gt;
&lt;DIV id="prochp.hpbin.proc_stmt" class="aa-section"&gt;
&lt;P class="xisDoc-paragraph"&gt;PROC HPBIN has a&amp;nbsp;Winsorized binning method.&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;Winsorize is also in the&amp;nbsp;Data Science Pilot Action Set.&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;Cheers,&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;Koen&lt;/P&gt;
&lt;/DIV&gt;
&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Sat, 07 Aug 2021 20:10:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760191#M240361</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-08-07T20:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Call the winsorization macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760195#M240362</link>
      <description>&lt;P&gt;The WINSORISE macro at WRDS calls another macro, also at WRDS, named NWORDS.&amp;nbsp; You didn't have the NWORDS macro, so it failed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The NWORDS macro was developed a long time ago, prior to the availability of the COUNTW function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you should be able to replace&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let nvars = %nwords(&amp;amp;vars);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;with&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let nvars = %sysfunc(countw(&amp;amp;vars));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 07 Aug 2021 21:53:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760195#M240362</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-08-07T21:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Call the winsorization macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760197#M240363</link>
      <description>&lt;P&gt;When using macros you can get a lot more detail in the log by adding some options. The System options MPRINT SYMBOLGEN and MLOGIC will provide details about the code generated, the steps in building macro variable values and the comparisons in the macro logic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would submit code such as this to turn the options, run the code then turn the option off.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;options mprint; 

%winsorize(inset = have, outset = want, sortvar = region, vars = number, perc1 = 2.5, trim = 0);

options nomprint;&lt;/PRE&gt;
&lt;P&gt;Now you will have more details in the log about the code generated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't use this macro but the sort of message you get is typically the result of either not providing the correct option in one of the parameters or possibly an unexpected character in one of your parameters. I might suggest removing the space before the 2.5 in the macro call in case it is something other than an actual simple blank character which might happen when copy and pasting text from some sources. If that doesn't help then show us all the, yes it gets ugly, generated from the macro call that the MPRINT option creates. We may then suggest if SYMBOLGEN or MLOGIC may be needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Aug 2021 22:05:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-the-winsorization-macro/m-p/760197#M240363</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-07T22:05:14Z</dc:date>
    </item>
  </channel>
</rss>

