<?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: Variable Name Truncation in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205926#M51242</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is not an easy solution, but it is very scalable and flexible.&amp;nbsp; You would need to change your logic and processing, but you could do this using three output data sets rather than one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=&amp;amp;output nway noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; var &amp;amp;vars;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; output out=qrange (keep=&amp;amp;vars) qrange=;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; output out=p25 (keep=&amp;amp;vars) p25=;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; output out=p75 (keep&amp;amp;vars) p75=;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By creating three data sets, you are free to re-use the original variable names to hold the calculated statistics.&amp;nbsp; To aggregate them later, you would need to read them one data set at a time:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data stats;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; array vars {&amp;amp;n} &amp;amp;vars;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; array ranges {&amp;amp;n} range1-range25;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; array q1 {&amp;amp;n} q1_1 - q1_&amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; array q3 {&amp;amp;n} q3_1 - q3_&amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set qrange;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do _i_=1 to &amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ranges{_i_} = vars{_i_};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set p25;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do _i_=1 to &amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; q1{_i_} = vars{_i_};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set p75;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do _i_=1 to &amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; q3{_i_} = vars{_i_};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ... more calculations as needed;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;In my mind, it's the right way to go because you never need to change any variable names.&amp;nbsp; Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Apr 2015 20:28:08 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2015-04-28T20:28:08Z</dc:date>
    <item>
      <title>Variable Name Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205923#M51239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using a macro that cap outliers based on box-plot / turkey method. But the problem arises PROC MEANS truncates variable names and the same problem happens with PROC LOGISTIC.&lt;/P&gt;&lt;P&gt;Example variable name : prod_INVT_OLD_BAL_AVG_ACT_1_3M&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This causes my macro to not working properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro box(input=, vars=, output= );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let QR=;&lt;/P&gt;&lt;P&gt;%let Q1=;&lt;/P&gt;&lt;P&gt;%let Q3=;&lt;/P&gt;&lt;P&gt;%let varL=;&lt;/P&gt;&lt;P&gt;%let varH=;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let n=%sysfunc(countw(&amp;amp;vars));&lt;/P&gt;&lt;P&gt;%do i= 1 %to &amp;amp;n;&lt;/P&gt;&lt;P&gt;%let val = %scan(&amp;amp;vars,&amp;amp;i);&lt;/P&gt;&lt;P&gt;%let QR = &amp;amp;QR &amp;amp;val._QRange;&lt;/P&gt;&lt;P&gt;%let Q1 = &amp;amp;Q1 &amp;amp;val._P25;&lt;/P&gt;&lt;P&gt;%let Q3 = &amp;amp;Q3 &amp;amp;val._P75;&lt;/P&gt;&lt;P&gt;%let varL = &amp;amp;varL &amp;amp;val.L;&lt;/P&gt;&lt;P&gt;%let varH = &amp;amp;varH &amp;amp;val.H;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Calculate the quartiles and inter-quartile range using proc univariate */&lt;/P&gt;&lt;P&gt;proc means data=&amp;amp;output nway noprint;&lt;/P&gt;&lt;P&gt;var &amp;amp;vars;&lt;/P&gt;&lt;P&gt;output out=temp QRANGE = P25= P75= / autoname;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Extract the upper and lower limits into macro variables */&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt;set temp;&lt;/P&gt;&lt;P&gt;ID = 1;&lt;/P&gt;&lt;P&gt;array vara(&amp;amp;n)&amp;nbsp; &amp;amp;QR;&lt;/P&gt;&lt;P&gt;array varb(&amp;amp;n)&amp;nbsp; &amp;amp;Q1;&lt;/P&gt;&lt;P&gt;array varc(&amp;amp;n)&amp;nbsp; &amp;amp;Q3;&lt;/P&gt;&lt;P&gt;array lower(&amp;amp;n) &amp;amp;varL;&lt;/P&gt;&lt;P&gt;array upper(&amp;amp;n) &amp;amp;varH;&lt;/P&gt;&lt;P&gt;do i = 1 to dim(vara);&lt;/P&gt;&lt;P&gt;lower(i) = varb(i) - 3 * vara(i);&lt;/P&gt;&lt;P&gt;upper(i) = varc(i) + 3 * vara(i);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;drop i _type_ _freq_;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp1;&lt;/P&gt;&lt;P&gt;set &amp;amp;input;&lt;/P&gt;&lt;P&gt;ID = 1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data &amp;amp;output;&lt;/P&gt;&lt;P&gt;merge temp1 temp;&lt;/P&gt;&lt;P&gt;by ID;&lt;/P&gt;&lt;P&gt;array vars(&amp;amp;n) &amp;amp;vars;&lt;/P&gt;&lt;P&gt;array lower(&amp;amp;n) &amp;amp;varL;&lt;/P&gt;&lt;P&gt;array upper(&amp;amp;n) &amp;amp;varH;&lt;/P&gt;&lt;P&gt;do i = 1 to dim(vars);&lt;/P&gt;&lt;P&gt;if not missing(vars(i)) then do;&lt;/P&gt;&lt;P&gt;if vars(i) &amp;lt; lower(i) then vars(i) = lower(i);&lt;/P&gt;&lt;P&gt;if vars(i) &amp;gt; upper(i) then vars(i) = upper(i);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;drop &amp;amp;QR &amp;amp;Q1 &amp;amp;Q3 &amp;amp;varL &amp;amp;varH ID i;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%box(input=abcd, vars = a b c d, output= test);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2015 19:11:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205923#M51239</guid>
      <dc:creator>Ujjawal</dc:creator>
      <dc:date>2015-04-28T19:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Name Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205924#M51240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you know what the maximum length of a SAS variable name is? When you provide a 30 character variable and use autoname option to add enough characters to exceed that number of characters what should SAS do for a result?&lt;/P&gt;&lt;P&gt;This will be a problem with any fixed length limit of variable names though:&lt;/P&gt;&lt;P&gt;prod_INVT_OLD_BAL_AVG_ACT_1_3M&lt;/P&gt;&lt;P&gt;could be&lt;/P&gt;&lt;P&gt;ProdInvtOldBalAvgAct_1_3M&lt;/P&gt;&lt;P&gt;and save a few characters without losing information. Not that I want to type either of those very often.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2015 20:03:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205924#M51240</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-04-28T20:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Name Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205925#M51241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know the variable names in SAS can have a maximum length of 32 characters. I am asking for a solution. I cannot remove "_" from a variable name. Thanks for your time!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2015 20:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205925#M51241</guid>
      <dc:creator>Ujjawal</dc:creator>
      <dc:date>2015-04-28T20:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Name Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205926#M51242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is not an easy solution, but it is very scalable and flexible.&amp;nbsp; You would need to change your logic and processing, but you could do this using three output data sets rather than one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=&amp;amp;output nway noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; var &amp;amp;vars;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; output out=qrange (keep=&amp;amp;vars) qrange=;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; output out=p25 (keep=&amp;amp;vars) p25=;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; output out=p75 (keep&amp;amp;vars) p75=;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By creating three data sets, you are free to re-use the original variable names to hold the calculated statistics.&amp;nbsp; To aggregate them later, you would need to read them one data set at a time:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data stats;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; array vars {&amp;amp;n} &amp;amp;vars;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; array ranges {&amp;amp;n} range1-range25;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; array q1 {&amp;amp;n} q1_1 - q1_&amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; array q3 {&amp;amp;n} q3_1 - q3_&amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set qrange;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do _i_=1 to &amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ranges{_i_} = vars{_i_};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set p25;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do _i_=1 to &amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; q1{_i_} = vars{_i_};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set p75;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do _i_=1 to &amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; q3{_i_} = vars{_i_};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ... more calculations as needed;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;In my mind, it's the right way to go because you never need to change any variable names.&amp;nbsp; Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2015 20:28:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205926#M51242</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-04-28T20:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Name Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205927#M51243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do you want in the output: The complete long variable name or the full suffix for the statistics requested with the autoname option? With variables named prod_INVT_OLD_BAL_AVG_ACT_1_3M you can't have both.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get lists of the variables generated by proc means like this:&lt;/P&gt;&lt;P&gt;proc sql ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; select NAME into : QR separated by ' '&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; from dictionary.columns &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where memname='TEMP' and Libname='WORK'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and index(upcase(NAME),'QRANGE')&amp;gt;0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; select NAME into : Q1 separated by ' '&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; from dictionary.columns &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where memname='TEMP' and Libname='WORK'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and index(upcase(NAME),'P25')&amp;gt;0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; select NAME into : Q3 separated by ' '&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; from dictionary.columns &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where memname='TEMP' and Libname='WORK'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and index(upcase(NAME),'P75')&amp;gt;0;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;Assuming none of the variables have the key words QRANGE, P25 or P75 as part of their names.&lt;/P&gt;&lt;P&gt;You wouldn't need the&lt;/P&gt;&lt;P&gt;%let QR = &amp;amp;QR &amp;amp;val._QRange;&lt;/P&gt;&lt;P&gt;%let Q1 = &amp;amp;Q1 &amp;amp;val._P25;&lt;/P&gt;&lt;P&gt;%let Q3 = &amp;amp;Q3 &amp;amp;val._P75;&lt;/P&gt;&lt;P&gt;any more.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2015 20:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205927#M51243</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-04-28T20:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Name Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205928#M51244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since you are using a macro you can make your own names for the variables you generate.&lt;/P&gt;&lt;P&gt;Call them VAR1 to VAR20 or SAM, JOE, FRED.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2015 21:38:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205928#M51244</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-04-28T21:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Name Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205929#M51245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;A __default_attr="818106" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://communities.sas.com/"&gt;&lt;/A&gt; Your code has several mistakes beyond your stated issue, that would be more concerning to me:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; proc means references the &amp;amp;output dataset when it should probably reference the &amp;amp;input dataset.&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; The following would only keep each macro variable retaining the last values, i.e. it doesn't do what you think it does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;%let n=%sysfunc(countw(&amp;amp;vars));&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;%do i= 1 %to &amp;amp;n;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;%let val = %scan(&amp;amp;vars,&amp;amp;i);&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;%let QR = &amp;amp;QR &amp;amp;val._QRange;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;%let Q1 = &amp;amp;Q1 &amp;amp;val._P25;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;%let Q3 = &amp;amp;Q3 &amp;amp;val._P75;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;%let varL = &amp;amp;varL &amp;amp;val.L;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;%let varH = &amp;amp;varH &amp;amp;val.H;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;%end;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;EDIT:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;I think this would have been your original source for the macro:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;A href="http://www.listendata.com/2015/04/sas-macro-capping-outliers.html" title="http://www.listendata.com/2015/04/sas-macro-capping-outliers.html"&gt;SAS Macro : Capping Outliers - Listen Data&lt;/A&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Here's a quick sample I wrote that works differently. Unless you have huge data where multiple passes on the data is an issue a modification of this method should work well.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;A href="https://gist.github.com/statgeek/31316a678433a1db8136" title="https://gist.github.com/statgeek/31316a678433a1db8136"&gt;SAS Box-Plot/Tukey Method of Capping Outliers&lt;/A&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC1"&gt;*Calculate IQR and first/third quartiles;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC2"&gt;proc means data=sashelp.class stackods n qrange p25 p75;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC3"&gt;var weight height;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC4"&gt;ods output summary=ranges;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC5"&gt;run;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC6"&gt;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC7"&gt;*create data with outliers to check;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC8"&gt;data capped; &lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC9"&gt;set sashelp.class;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC10"&gt;if name='Alfred' then weight=220;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC11"&gt;if name='Jane' then height=-30;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC12"&gt;run;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC13"&gt;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC14"&gt;*macro to cap outliers;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC15"&gt;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC16"&gt;%macro cap(dset=,var=, lower=, upper=);&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC17"&gt;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC18"&gt;data &amp;amp;dset;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC19"&gt;set &amp;amp;dset;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC20"&gt;if &amp;amp;var&amp;gt;&amp;amp;upper then &amp;amp;var=&amp;amp;upper;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC21"&gt;if &amp;amp;var&amp;lt;&amp;amp;lower then &amp;amp;var=&amp;amp;lower;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC22"&gt;run;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC23"&gt;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC24"&gt;%mend;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC25"&gt;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC26"&gt;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC27"&gt;*create cutoffs and execute macro for each variable;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC28"&gt;data cutoffs;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC29"&gt;set ranges;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC30"&gt;lower=p25-3*qrange;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC31"&gt;upper=p75+3*qrange;&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC32"&gt;string = catt('%cap(dset=capped, var=', variable, ", lower=", lower, ", upper=", upper ,");");&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC33"&gt;call execute(string);&lt;/P&gt;&lt;P class="line" id="file-sas_bp_cap_outliers-LC34"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2015 02:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205929#M51245</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-04-29T02:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Variable Name Truncation</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205930#M51246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much. It's a nice code but it will be very heavy as my dataset consists of 1 million observations and 1K variables. But i learnt a lot of tricks from your code. Yes, i have copied code from that site. I have written an email to the author regd issues you highlighted just above. God bless you! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2015 19:43:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Variable-Name-Truncation/m-p/205930#M51246</guid>
      <dc:creator>Ujjawal</dc:creator>
      <dc:date>2015-04-29T19:43:07Z</dc:date>
    </item>
  </channel>
</rss>

