<?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: Syntax for finding outliers - &amp;quot;Apparent symbolic reference AMP not resolved.&amp;quot; in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781821#M31832</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36911"&gt;@_maldini_&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;Do I need to create or define the macro before running the syntax? How do I run a macro?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Auto_Outliers(Dsn=Clean.Patients,
               Id=Patno,
               Var_List=HR SBP DBP,
               Trim=.1,
               N_Sd=2.5)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;1. Download the macro code from the page as instructed&lt;/P&gt;
&lt;P&gt;2. Save it to your computer and note the location&lt;/P&gt;
&lt;P&gt;3. Compile the macro and run it&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you code will look like the following in the end.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%include 'path to file from Step 2.sas' / source2;

%auto_outliers(dsn=.....);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;UCLA introductory tutorial on macro variables and macros&lt;BR /&gt;&lt;A href="https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Examples of common macro usage&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Nov 2021 00:56:17 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-11-23T00:56:17Z</dc:date>
    <item>
      <title>Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/780888#M31673</link>
      <description>&lt;P&gt;I am trying to write syntax that will identify outliers. I am using &lt;A href="https://sasexamplecode.com/3-easy-ways-to-find-outliers-in-sas" target="_self"&gt;these instructions&lt;/A&gt; as guidance.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am running into some errors &lt;U&gt;in the DATA step&lt;/U&gt;, including "&lt;SPAN&gt;Apparent symbolic reference AMP not resolved." I know nothing about Macros in SAS.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This is my syntax:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/* 3 Easy Ways to Find Outliers in SAS */
/* https://sasexamplecode.com/3-easy-ways-to-find-outliers-in-sas/ */

/* 1. Test the Assumption of Normality */
/* The first step if to test the normality assumption. */

/* In SAS, you can use PROC UNIVARIATE to check if your data follow a normal distribution.  */
/* You do this by adding the NORMAL option to the UNIVARIATE statement. */


ods output TestsForNormality = work.normal_test;
ods output BasicMeasures = work.measures;
 
proc univariate data=meta.data_01 normal;
    var age;
 
    histogram age / normal;
run;
 
proc print data=work.normal_test noobs;
run;
 
proc print data=work.measures noobs;
run;


/* 2. Save the Mean and Standard Deviation as Macro Variables */
/* The second step to find outliers is to save the Mean and Standard Deviation as macro variables. */

/* PROC UNIVARIATE can also create a dataset with summary statistics such as the p-value of the normality test, the mean, and the standard deviation.  */
/* To do so, we use the ODS OUTPUT statement. */
/* See above */

/* To make your code reusable and to find the outliers more efficiently, we save the p-value of the Shapiro-Wilk test,  */
/* the mean, and the standard deviation as three macro variables with a SELECT INTO statement. */
/* See below */

proc sql;
    select pValue label= 'p-value' into :pvalue from work.normal_test where test = 'Shapiro-Wilk';
    select LocValue label = 'Mean' into :mean from work.measures where LocMeasure ='Mean';
    select VarValue label = 'Std Dev' into :stddev from work.measures where VarMeasure ='Std Deviation';
quit;

/* 3. Filter the Outliers */
/* The third step to find outliers in SAS is filtering all observations that are 3 standard deviations above or below the mean. */

data work.outliers_normaldistr;
    set meta.data_01;
 
    if age lt (&amp;amp;amp;mean. - 3*&amp;amp;amp;stddev.) 
	or age gt (&amp;amp;amp;mean. + 3*&amp;amp;amp;stddev.) then output;
run;
 
proc print data=work.outliers_normaldistr noobs;
run;&lt;/PRE&gt;
&lt;P&gt;Here is the log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;68&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;69 data work.outliers_normaldistr;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;70 set meta.data_01;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;71&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;72 if age lt (&amp;amp;amp;mean. - 3*&amp;amp;amp;stddev.)&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;_ _____&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;386 180&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;76&lt;/DIV&gt;
&lt;DIV id="sasLogWarning1_1637186092947" class="sasWarning"&gt;WARNING: Apparent symbolic reference AMP not resolved.&lt;/DIV&gt;
&lt;DIV id="sasLogWarning2_1637186092947" class="sasWarning"&gt;WARNING: Apparent symbolic reference AMP not resolved.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;72 if age lt (&amp;amp;amp;mean. - 3*&amp;amp;amp;stddev.)&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;_______&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;180&lt;/DIV&gt;
&lt;DIV id="sasLogError1_1637186092947" class="sasError"&gt;ERROR 386-185: Expecting an arithmetic expression.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="sasLogError2_1637186092947" class="sasError"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="sasLogError3_1637186092947" class="sasError"&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;73 or age gt (&amp;amp;amp;mean. + 3*&amp;amp;amp;stddev.) then output;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;_____ _______&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;180 180&lt;/DIV&gt;
&lt;DIV id="sasLogWarning3_1637186092947" class="sasWarning"&gt;WARNING: Apparent symbolic reference AMP not resolved.&lt;/DIV&gt;
&lt;DIV id="sasLogWarning4_1637186092947" class="sasWarning"&gt;WARNING: Apparent symbolic reference AMP not resolved.&lt;/DIV&gt;
&lt;DIV id="sasLogError4_1637186092947" class="sasError"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;74 run;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="sasLogNote1_1637186092947" class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;
&lt;DIV id="sasLogWarning5_1637186092947" class="sasWarning"&gt;WARNING: The data set WORK.OUTLIERS_NORMALDISTR may be incomplete. When this step was stopped there were 0 observations and 164&lt;/DIV&gt;
&lt;DIV class="sasWarning"&gt;variables.&lt;/DIV&gt;
&lt;DIV id="sasLogWarning6_1637186092947" class="sasWarning"&gt;WARNING: Data set WORK.OUTLIERS_NORMALDISTR was not replaced because this step was stopped.&lt;/DIV&gt;
&lt;DIV id="sasLogNote2_1637186092947" class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;user cpu time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;system cpu time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;memory 1424.18k&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;OS Memory 36008.00k&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Timestamp 11/17/2021 09:54:53 PM&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Step Count 282 Switch Count 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Page Faults 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Page Reclaims 92&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Page Swaps 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Voluntary Context Switches 6&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Involuntary Context Switches 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Block Input Operations 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Block Output Operations 8&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;75&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;76 proc print data=work.outliers_normaldistr noobs;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;77 run;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="sasLogNote3_1637186092947" class="sasNote"&gt;NOTE: No variables in data set WORK.OUTLIERS_NORMALDISTR.&lt;/DIV&gt;
&lt;DIV id="sasLogNote4_1637186092947" class="sasNote"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;user cpu time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;system cpu time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;memory 478.43k&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;OS Memory 35488.00k&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Timestamp 11/17/2021 09:54:53 PM&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Step Count 283 Switch Count 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Page Faults 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Page Reclaims 16&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Page Swaps 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Voluntary Context Switches 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Involuntary Context Switches 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Block Input Operations 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Block Output Operations 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;78&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;79 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;89&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;Here is a sample data set:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data WORK.DATA_04;
   infile datalines dsd truncover;
   input Participant_ID:$3. Group:$1. Sex:$2. Age:BEST12. Efflux_V1:BEST12. Efflux_V2:BEST12. Efflux_V3:BEST12. ApoA1_V1:BEST12. ApoA1_V2:BEST12. ApoA1_V3:BEST12. ApoC1_V1:BEST12. ApoC1_V2:BEST12. ApoC1_V3:BEST12.;
   format Age BEST12. Efflux_V1 BEST12. Efflux_V2 BEST12. Efflux_V3 BEST12. ApoA1_V1 BEST12. ApoA1_V2 BEST12. ApoA1_V3 BEST12. ApoC1_V1 BEST12. ApoC1_V2 BEST12. ApoC1_V3 BEST12.;
 datalines;
 1 A M 52 11.68 12.59 11.21 238.65 279.72 171.58 41.22 62.36 36.07
 10 B M 68 9.58 9.18 10.78 215.79 214.9 253.98 47.33 38 50.52
 11 A F 71 12.26 9.17 9.94 282.3 227.08 282.3 44.13 44.21 44.13
 12 B M 71 5.88 9.45 10.55 173.07 230.49 174.09 47.8 51.28 37.81
 13 A F 71 13.17 12.69 11.33 259.03 265.83 255.03 61.34 67.46 73.5
 14 B M 54 10.51 7.96 8.28 211.39 192.76 192.17 41.14 36.83 34.86
 15 A F 66 7.34 6.74 8.69 240.58 160.97 205.72 35.8 25.89 44.28
 16 B F 69 11.07 13.44 10.08 236.45 242.66 214.03 54.07 55.34 37.61
 17 A F 58 8.1 7.62 8.03 188.51 159.8 164.22 36.04 32.35 30.78
 18 B F 63 10.14 10.06 10.78 229.05 252.06 228.63 57.49 63.17 50.44
 ;;;;
Run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Finally, if possible, it would be helpful to list the outliers by&amp;nbsp;Participant_ID. Is there a way to modify this syntax to do so?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Nov 2021 22:03:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/780888#M31673</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2021-11-17T22:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/780892#M31676</link>
      <description>&lt;P&gt;Macro variable &amp;amp;AMP has never been defined, so you can't refer to it in your code. I see that the web site you link to doesn't provide guidance on that either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But instead of trying to determine if a variable is more than ±3 standard deviations from the mean, you can use &lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/statug/statug_stdize_toc.htm" target="_self"&gt;PROC STDIZE&lt;/A&gt; and then no macro variables are needed at all.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Nov 2021 22:20:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/780892#M31676</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-17T22:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/780901#M31682</link>
      <description>&lt;P&gt;When who ever owns that site uploaded the code, the code got converted to HTML incorrectly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe this is a better reference for what you need?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sgf/2020/02/05/finding-possible-data-errors-using-the-auto_outliers-macro/" target="_blank"&gt;https://blogs.sas.com/content/sgf/2020/02/05/finding-possible-data-errors-using-the-auto_outliers-macro/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;amp;AMP; is actually supposed to be just &amp;amp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So this&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.outliers_normaldistr;
    set meta.data_01;
 
    if age lt (&amp;amp;amp;mean. - 3*&amp;amp;amp;stddev.) 
	or age gt (&amp;amp;amp;mean. + 3*&amp;amp;amp;stddev.) then output;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Should be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.outliers_normaldistr;
    set meta.data_01;
 
    if age lt (&amp;amp;mean. - 3*&amp;amp;stddev.) 
	or age gt (&amp;amp;mean. + 3*&amp;amp;stddev.) then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36911"&gt;@_maldini_&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to write syntax that will identify outliers. I am using &lt;A href="https://sasexamplecode.com/3-easy-ways-to-find-outliers-in-sas" target="_self"&gt;these instructions&lt;/A&gt; as guidance.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am running into some errors &lt;U&gt;in the DATA step&lt;/U&gt;, including "&lt;SPAN&gt;Apparent symbolic reference AMP not resolved." I know nothing about Macros in SAS.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This is my syntax:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/* 3 Easy Ways to Find Outliers in SAS */
/* https://sasexamplecode.com/3-easy-ways-to-find-outliers-in-sas/ */

/* 1. Test the Assumption of Normality */
/* The first step if to test the normality assumption. */

/* In SAS, you can use PROC UNIVARIATE to check if your data follow a normal distribution.  */
/* You do this by adding the NORMAL option to the UNIVARIATE statement. */


ods output TestsForNormality = work.normal_test;
ods output BasicMeasures = work.measures;
 
proc univariate data=meta.data_01 normal;
    var age;
 
    histogram age / normal;
run;
 
proc print data=work.normal_test noobs;
run;
 
proc print data=work.measures noobs;
run;


/* 2. Save the Mean and Standard Deviation as Macro Variables */
/* The second step to find outliers is to save the Mean and Standard Deviation as macro variables. */

/* PROC UNIVARIATE can also create a dataset with summary statistics such as the p-value of the normality test, the mean, and the standard deviation.  */
/* To do so, we use the ODS OUTPUT statement. */
/* See above */

/* To make your code reusable and to find the outliers more efficiently, we save the p-value of the Shapiro-Wilk test,  */
/* the mean, and the standard deviation as three macro variables with a SELECT INTO statement. */
/* See below */

proc sql;
    select pValue label= 'p-value' into :pvalue from work.normal_test where test = 'Shapiro-Wilk';
    select LocValue label = 'Mean' into :mean from work.measures where LocMeasure ='Mean';
    select VarValue label = 'Std Dev' into :stddev from work.measures where VarMeasure ='Std Deviation';
quit;

/* 3. Filter the Outliers */
/* The third step to find outliers in SAS is filtering all observations that are 3 standard deviations above or below the mean. */

data work.outliers_normaldistr;
    set meta.data_01;
 
    if age lt (&amp;amp;amp;mean. - 3*&amp;amp;amp;stddev.) 
	or age gt (&amp;amp;amp;mean. + 3*&amp;amp;amp;stddev.) then output;
run;
 
proc print data=work.outliers_normaldistr noobs;
run;&lt;/PRE&gt;
&lt;P&gt;Here is the log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;68&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;69 data work.outliers_normaldistr;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;70 set meta.data_01;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;71&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;72 if age lt (&amp;amp;amp;mean. - 3*&amp;amp;amp;stddev.)&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;_ _____&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;386 180&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;76&lt;/DIV&gt;
&lt;DIV id="sasLogWarning1_1637186092947" class="sasWarning"&gt;WARNING: Apparent symbolic reference AMP not resolved.&lt;/DIV&gt;
&lt;DIV id="sasLogWarning2_1637186092947" class="sasWarning"&gt;WARNING: Apparent symbolic reference AMP not resolved.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;72 if age lt (&amp;amp;amp;mean. - 3*&amp;amp;amp;stddev.)&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;_______&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;180&lt;/DIV&gt;
&lt;DIV id="sasLogError1_1637186092947" class="sasError"&gt;ERROR 386-185: Expecting an arithmetic expression.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="sasLogError2_1637186092947" class="sasError"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="sasLogError3_1637186092947" class="sasError"&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;73 or age gt (&amp;amp;amp;mean. + 3*&amp;amp;amp;stddev.) then output;&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;_____ _______&lt;/DIV&gt;
&lt;DIV class="sasError"&gt;180 180&lt;/DIV&gt;
&lt;DIV id="sasLogWarning3_1637186092947" class="sasWarning"&gt;WARNING: Apparent symbolic reference AMP not resolved.&lt;/DIV&gt;
&lt;DIV id="sasLogWarning4_1637186092947" class="sasWarning"&gt;WARNING: Apparent symbolic reference AMP not resolved.&lt;/DIV&gt;
&lt;DIV id="sasLogError4_1637186092947" class="sasError"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;74 run;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="sasLogNote1_1637186092947" class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;
&lt;DIV id="sasLogWarning5_1637186092947" class="sasWarning"&gt;WARNING: The data set WORK.OUTLIERS_NORMALDISTR may be incomplete. When this step was stopped there were 0 observations and 164&lt;/DIV&gt;
&lt;DIV class="sasWarning"&gt;variables.&lt;/DIV&gt;
&lt;DIV id="sasLogWarning6_1637186092947" class="sasWarning"&gt;WARNING: Data set WORK.OUTLIERS_NORMALDISTR was not replaced because this step was stopped.&lt;/DIV&gt;
&lt;DIV id="sasLogNote2_1637186092947" class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;user cpu time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;system cpu time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;memory 1424.18k&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;OS Memory 36008.00k&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Timestamp 11/17/2021 09:54:53 PM&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Step Count 282 Switch Count 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Page Faults 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Page Reclaims 92&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Page Swaps 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Voluntary Context Switches 6&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Involuntary Context Switches 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Block Input Operations 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Block Output Operations 8&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;75&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;76 proc print data=work.outliers_normaldistr noobs;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;77 run;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="sasLogNote3_1637186092947" class="sasNote"&gt;NOTE: No variables in data set WORK.OUTLIERS_NORMALDISTR.&lt;/DIV&gt;
&lt;DIV id="sasLogNote4_1637186092947" class="sasNote"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;user cpu time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;system cpu time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;memory 478.43k&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;OS Memory 35488.00k&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Timestamp 11/17/2021 09:54:53 PM&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Step Count 283 Switch Count 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Page Faults 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Page Reclaims 16&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Page Swaps 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Voluntary Context Switches 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Involuntary Context Switches 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Block Input Operations 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Block Output Operations 0&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;78&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;79 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;89&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;Here is a sample data set:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data WORK.DATA_04;
   infile datalines dsd truncover;
   input Participant_ID:$3. Group:$1. Sex:$2. Age:BEST12. Efflux_V1:BEST12. Efflux_V2:BEST12. Efflux_V3:BEST12. ApoA1_V1:BEST12. ApoA1_V2:BEST12. ApoA1_V3:BEST12. ApoC1_V1:BEST12. ApoC1_V2:BEST12. ApoC1_V3:BEST12.;
   format Age BEST12. Efflux_V1 BEST12. Efflux_V2 BEST12. Efflux_V3 BEST12. ApoA1_V1 BEST12. ApoA1_V2 BEST12. ApoA1_V3 BEST12. ApoC1_V1 BEST12. ApoC1_V2 BEST12. ApoC1_V3 BEST12.;
 datalines;
 1 A M 52 11.68 12.59 11.21 238.65 279.72 171.58 41.22 62.36 36.07
 10 B M 68 9.58 9.18 10.78 215.79 214.9 253.98 47.33 38 50.52
 11 A F 71 12.26 9.17 9.94 282.3 227.08 282.3 44.13 44.21 44.13
 12 B M 71 5.88 9.45 10.55 173.07 230.49 174.09 47.8 51.28 37.81
 13 A F 71 13.17 12.69 11.33 259.03 265.83 255.03 61.34 67.46 73.5
 14 B M 54 10.51 7.96 8.28 211.39 192.76 192.17 41.14 36.83 34.86
 15 A F 66 7.34 6.74 8.69 240.58 160.97 205.72 35.8 25.89 44.28
 16 B F 69 11.07 13.44 10.08 236.45 242.66 214.03 54.07 55.34 37.61
 17 A F 58 8.1 7.62 8.03 188.51 159.8 164.22 36.04 32.35 30.78
 18 B F 63 10.14 10.06 10.78 229.05 252.06 228.63 57.49 63.17 50.44
 ;;;;
Run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Finally, if possible, it would be helpful to list the outliers by&amp;nbsp;Participant_ID. Is there a way to modify this syntax to do so?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Nov 2021 22:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/780901#M31682</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-17T22:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/780902#M31683</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are trying to find univariate outliers as I see it.&lt;/P&gt;
&lt;P&gt;See these blogs for (other) code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Detecting outliers in SAS: Part 1: Estimating location&lt;BR /&gt;By Rick Wicklin on The DO Loop January 20, 2012 &lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2012/01/20/detecting-outliers-in-sas-part-1-estimating-location.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2012/01/20/detecting-outliers-in-sas-part-1-estimating-location.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Detecting outliers in SAS: Part 2: Estimating scale&lt;BR /&gt;By Rick Wicklin on The DO Loop January 27, 2012 &lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2012/01/27/detecting-outliers-in-sas-part-2-estimating-scale.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2012/01/27/detecting-outliers-in-sas-part-2-estimating-scale.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if you also want to find multi-variate outliers. That can be done with PROC ROBUSTREG, isolation forests, auto-encoders (NN), PROC PRINCOMP, and some other techniques I am forgetting about right now.&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>Wed, 17 Nov 2021 22:41:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/780902#M31683</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-11-17T22:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/780923#M31691</link>
      <description>&lt;P&gt;Bet you copied code from somewhere on the web and didn't pay attention that a character was replaced with &amp;amp;amp&lt;/P&gt;
&lt;P&gt;If you did not actually write &amp;amp;amp or even more the &amp;amp;amp; in this&lt;/P&gt;
&lt;PRE&gt;    if age lt (&lt;FONT color="#800080"&gt;&lt;STRONG&gt;&amp;amp;amp;&lt;/STRONG&gt;&lt;/FONT&gt;mean. - 3*&lt;FONT color="#800080"&gt;&lt;STRONG&gt;&amp;amp;amp;&lt;/STRONG&gt;&lt;/FONT&gt;stddev.) 
	or age gt (&lt;FONT color="#800080"&gt;&lt;STRONG&gt;&amp;amp;amp;&lt;/STRONG&gt;&lt;/FONT&gt;mean. + 3*&lt;FONT color="#800080"&gt;&lt;STRONG&gt;&amp;amp;amp;&lt;/STRONG&gt;&lt;/FONT&gt;stddev.) then output;&lt;/PRE&gt;
&lt;P&gt;delete the &amp;amp;amp; .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 01:41:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/780923#M31691</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-11-18T01:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/780928#M31692</link>
      <description>The original source has the error. OPs first post includes the link to the source.</description>
      <pubDate>Thu, 18 Nov 2021 02:43:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/780928#M31692</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-18T02:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781083#M31720</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;Thank you.&lt;/P&gt;
&lt;P&gt;This worked (for age) and I will accept this as the solution. But...it leads to 2 other questions/issues:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Why doesn't this work when I change the variable from age to Efflux_V1, for example?&lt;/LI&gt;
&lt;LI&gt;How can I adapt this syntax to incorporate multiple variables?&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Why doesn't this work when I change the variable from age to Efflux_V1?&lt;/P&gt;
&lt;P&gt;When I keep the syntax exactly the same, but change age to Efflux_V1, I get the following:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-11-18 at 9.23.55 AM.png" style="width: 174px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65880iAC9199EC84CE21E0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2021-11-18 at 9.23.55 AM.png" alt="Screen Shot 2021-11-18 at 9.23.55 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;12.07 does not meet the definition of an outlier&amp;nbsp;(i.e.,&amp;nbsp;(&amp;amp;mean. - 3*&amp;amp;stddev.) ,&amp;nbsp;(&amp;amp;mean. + 3*&amp;amp;stddev.)).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. How can I adapt this syntax to incorporate multiple variables?&lt;/P&gt;
&lt;P&gt;Here is my attempt to simply add 3 more variables, in addition to age:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;ods output TestsForNormality = work.normal_test;
ods output BasicMeasures = work.measures;
 
proc univariate data=meta.data_01 normal;
    var 
    age
 	Efflux_V1
	Efflux_V2
	Efflux_V3
	;
 
/*     histogram age / normal; */
run;
 
proc print data=work.normal_test noobs;
run;
 
proc print data=work.measures noobs;
run;

proc sql;
    select pValue label= 'p-value' into :pvalue from work.normal_test where test = 'Shapiro-Wilk';
    select LocValue label = 'Mean' into :mean from work.measures where LocMeasure ='Mean';
    select VarValue label = 'Std Dev' into :stddev from work.measures where VarMeasure ='Std Deviation';
quit;

data work.outliers_normaldistr;
    set meta.data_01;
 
    if age lt (&amp;amp;mean. - 3*&amp;amp;stddev.) 
	or age gt (&amp;amp;mean. + 3*&amp;amp;stddev.) then output;
	
	if Efflux_V1 lt (&amp;amp;mean. - 3*&amp;amp;stddev.) 
	or Efflux_V1 gt (&amp;amp;mean. + 3*&amp;amp;stddev.) then output;

	if Efflux_V2 lt (&amp;amp;mean. - 3*&amp;amp;stddev.) 
	or Efflux_V2 gt (&amp;amp;mean. + 3*&amp;amp;stddev.) then output;
	
	if Efflux_V3 lt (&amp;amp;mean. - 3*&amp;amp;stddev.) 
	or Efflux_V3 gt (&amp;amp;mean. + 3*&amp;amp;stddev.) then output;
run;


proc print data=work.outliers_normaldistr noobs;
Var participant_id age Efflux_V1--Efflux_V3;
/* Var participant_id age; */
run;
&lt;/LI-CODE&gt;
&lt;P&gt;Here is the output:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-11-18 at 9.13.32 AM.png" style="width: 274px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65882iB92D66596C601914/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2021-11-18 at 9.13.32 AM.png" alt="Screen Shot 2021-11-18 at 9.13.32 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I will continue to review the other resources you posted. Thank you for your time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 17:40:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781083#M31720</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2021-11-18T17:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781086#M31721</link>
      <description>This code isn't designed to handle multiple variables and I wouldn't use it as such, instead I would highly recommend using one of the other solutions suggested by myself or Koen. Looking through the steps of this procedure, it captures the mean/stdev but does so for one at a time. So this solution to be re-written to handle multiple values would be cumbersome when there are better options out there. &lt;BR /&gt;&lt;BR /&gt;Also this code outputs only the outliers. Usually you want to do something with them, ie cap, remove or examine, so you may want to explain what you'd like to do with the outputs. &lt;BR /&gt;&lt;BR /&gt;As shown your output doesn't make sense because it's using the mean/std from the age variable most likely which have no relation to the other variables so that's why the output is all wrong. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Nov 2021 17:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781086#M31721</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-18T17:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781087#M31722</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;How can I adapt this syntax to incorporate multiple variables?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC STDIZE&lt;/P&gt;
&lt;P&gt;PROC STDIZE&lt;/P&gt;
&lt;P&gt;PROC STDIZE&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 17:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781087#M31722</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-18T17:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781090#M31723</link>
      <description>Ok ok ok...</description>
      <pubDate>Thu, 18 Nov 2021 18:10:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781090#M31723</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2021-11-18T18:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781138#M31728</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking at the&lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/statug/statug_stdize_gettingstarted.htm" target="_self"&gt; STDIZE Procedure documentation&lt;/A&gt;. I'm not sure how this solves my problem. My goal is to identify outliers (PROC UNIVARIATE shows extreme values, but it doesn't help me determine if they meet my definition of an outlier, e.g. =&amp;nbsp;1.5*IQR, 3STD*mean) for multiple variables and then remove them, if they should be removed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I'm understanding this correctly (big IF), in the&amp;nbsp;STDIZE Procedure documentation, it uses PROC UNIVARIATE to find extreme values by group. Then uses&amp;nbsp;PROC STDIZE with the STD method to compute location and scale measures (Don't we already have those from PROC&amp;nbsp;UNIVARIATE?). Then It uses various standardization methods (i.e., MAD, IQR, ABW) to produce location and scale measures that are resistant to outliers, and superior to the STD method, and somehow uses a tuning constant (derived how?) to do so. Then it uses a DATA step to delete the outlier. And it does this for one variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where does it determine that "64" is actually an outlier and not just an extreme value? Because of its impact on the dispersion ratio? I don't see formulas for dispersion ratio for figure 109.1 or the tuning constant. Do I need these?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not a professional statistician or a very sophisticated SAS user. Any 4th grade level explanation you could offer would be appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 21:27:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781138#M31728</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2021-11-18T21:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781142#M31731</link>
      <description>That was one of three or four solutions suggested. Did you look at the auto_outliers I linked to that allows you to specify the criteria, put in your input data set and then generates an output file of all possible outliers?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/sgf/2020/02/05/finding-possible-data-errors-using-the-auto_outliers-macro/" target="_blank"&gt;https://blogs.sas.com/content/sgf/2020/02/05/finding-possible-data-errors-using-the-auto_outliers-macro/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;You don't indicate what you want to do with these so we can't offer better suggestions than identifying them at this point.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Nov 2021 21:30:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781142#M31731</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-18T21:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781144#M31732</link>
      <description>Not yet. I left that one to last. I got scared when I saw that it involved macros...The trimmed and winsorized means blog posts were great. Thank you. &lt;BR /&gt;My goal: Find some syntax that I can use repeatedly to find outliers - for multiple variables - based on a set of pre-defined criteria (e.g., 1.5*IQR, 3*STD). Evaluate those outliers and decide if they should remain in the data set (more based on whether they are errors / reasonable than on their influence on the measures of central tendency). And then delete them, if I determine they are errors or not reasonable.</description>
      <pubDate>Thu, 18 Nov 2021 21:37:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781144#M31732</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2021-11-18T21:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781145#M31733</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36911"&gt;@_maldini_&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you ask : Where does it determine that "64" is actually an outlier and not just an extreme value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;... Outlier versus "just" an extreme value : That is a difficult consideration to make. And a matter of definitions. It also depends on what you want to achieve.&lt;/P&gt;
&lt;P&gt;If your subject matter is so "sensitive", I am afraid the simple rule with the standard box plot will not help you out.&lt;/P&gt;
&lt;P&gt;There exist Robust / Adjusted Box-plots for Detecting Outliers in Skewed Distributions. You might need these. &lt;BR /&gt;&lt;BR /&gt;What do you want to do with your data? If you will fit a model, you can also determine every observation's relative impact on the results.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#800000"&gt;[EDIT]&lt;/FONT&gt; I am &lt;FONT color="#FF0000"&gt;NOT&lt;/FONT&gt; saying an observation with a high weight / impact should be considered an outlier, let alone it should be removed from the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And again : uni-variate outlier detection can be done with multiple methods, not just via mean and std and IQR-calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 21:55:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781145#M31733</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-11-18T21:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781148#M31734</link>
      <description>The auto_outliers approach looks great, but I'm not sure where to put the Macro syntax used in the example. I don't know how to use Macros. Do I put it in a PROC step?</description>
      <pubDate>Thu, 18 Nov 2021 21:49:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781148#M31734</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2021-11-18T21:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781149#M31735</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36911"&gt;@_maldini_&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking at the&lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/statug/statug_stdize_gettingstarted.htm" target="_self"&gt; STDIZE Procedure documentation&lt;/A&gt;. I'm not sure how this solves my problem. My goal is to identify outliers (PROC UNIVARIATE shows extreme values, but it doesn't help me determine if they meet my definition of an outlier, e.g. =&amp;nbsp;1.5*IQR, 3STD*mean) for multiple variables and then remove them, if they should be removed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I'm understanding this correctly (big IF), in the&amp;nbsp;STDIZE Procedure documentation, it uses PROC UNIVARIATE to find extreme values by group. Then uses&amp;nbsp;PROC STDIZE with the STD method to compute location and scale measures (Don't we already have those from PROC&amp;nbsp;UNIVARIATE?).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;PROC STDIZE does not require you first run PROC UNIVARIATE. PROC STDIZE does its own calculations. It produces values that are standardized by whatever method you choose. THe program you are working with where the macro variables are causing problems uses what is the STD method in PROC STDIZE. Any standardized value produced by PROC STDIZE which is &amp;gt;3 or &amp;lt;–3 is a potential outlier, by the same calculations you were doing originally. With the STD method, there is no "tuning".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Where does it determine that "64" is actually an outlier and not just an extreme value? Because of its impact on the dispersion ratio? I don't see formulas for dispersion ratio for figure 109.1 or the tuning constant. Do I need these?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Statistical methods do not determine whether something is an outlier. You, the human user, have to determine if it is an outlier. Your original program was looking for observations in which the data value was more than 3 standard deviations from the mean. This is exactly what PROC STDIZE is doing. What you choose to do with that information is up to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The nice thing about PROC STDIZE is that it works on 50 variables if that's how many you have; it works on 500 if that's have many you have, and so on. And no macro is needed. (Of course, the macros discussed probably use more sophisticated methods to determine if something is an outlier)&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 21:54:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781149#M31735</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-18T21:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781150#M31736</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am "afraid" a macro is unavoidable.&lt;/P&gt;
&lt;P&gt;But nothing to be scared about ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you do not have Enterprise Miner or Model Studio, you need coding for this and with coding you will need macro's.&lt;/P&gt;
&lt;P&gt;Check out if this entry brings you any further :&lt;/P&gt;
&lt;P&gt;Macro to identify and output outliers for multiple variables in a dataset&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Macro-to-identify-and-output-outliers-for-multiple-variables-in/td-p/526165" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Macro-to-identify-and-output-outliers-for-multiple-variables-in/td-p/526165&lt;/A&gt;&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>Thu, 18 Nov 2021 21:50:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781150#M31736</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-11-18T21:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781811#M31828</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;If I'm understanding you correctly, the STD method in PROC&amp;nbsp;STDIZE sets the cutoff for outliers at &amp;gt; mean + 3(std) or &amp;lt; mean – 3(std) and provides measures of location and scale that are "standardized" and thus resistant to outliers (Using whatever definition is associated w/ a given method).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I use the data and syntax in &lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/statug/statug_stdize_gettingstarted.htm#statug.stdize.sdzg1b" target="_self"&gt;the documentation&lt;/A&gt;, however, the mean and std is the same when using PROC UNIVARIATE (only the&amp;nbsp;Extreme Observations table is provided in the documentation) and&amp;nbsp;PROC&amp;nbsp;STDIZE (Figure 109.3).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The extreme value in the example is 64 (Obs 23). 153.3 (mean w/ outlier) - 3(30.0667678)(std w/ outlier) = 61.&amp;nbsp;So observation 23 does NOT meet the definition using the STD method, thus the mean is the same when using PROC UNIVARIATE and PROC STDIZE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I changed the value from 64 to 24, well below 61. When I do this, the standardized mean and std produced by PROC STDIZE are different from the unstandardized mean and std produced by PROC UNIVARIATE. This approach seems similar to trimming and winsorizing means, no?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The extreme values in PROC UNIVARIATE are helpful, but I don't know if they meet the definition of an outlier (as defined by me) unless I perform some calculations (e.g.,153.3 (mean w/ outlier) - 3(30.0667678)(std w/ outlier) = 63.1). I'm looking for an approach that tells me if certain values are outliers based on a definition I choose (similar to standardization methods in PROC STDIZE), so that I can evaluate those observations to determine what to do with them. It sounds like you think PROC STDIZE does this, but I don't see it in the documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 23:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781811#M31828</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2021-11-22T23:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781815#M31829</link>
      <description>Looking for values that are  &amp;gt; mean + 3STD that is the mathematical equivalent of filtering values with a standardized value of 3+ or 3- when you standardize them using the Z score method. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Nov 2021 23:27:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781815#M31829</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-22T23:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax for finding outliers - "Apparent symbolic reference AMP not resolved."</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781817#M31830</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;Do I need to create or define the macro before running the syntax? How do I run a macro?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Auto_Outliers(Dsn=Clean.Patients,
               Id=Patno,
               Var_List=HR SBP DBP,
               Trim=.1,
               N_Sd=2.5)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Nov 2021 23:40:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Syntax-for-finding-outliers-quot-Apparent-symbolic-reference-AMP/m-p/781817#M31830</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2021-11-22T23:40:11Z</dc:date>
    </item>
  </channel>
</rss>

