<?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 ERROR 180-322: Statement is not valid or it is used out of proper order. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/795320#M255084</link>
    <description>&lt;PRE&gt;&lt;CODE class=""&gt;I am getting the following error when running the code below. Any help in debugging would be great &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1                                                          The SAS System                          10:29 Wednesday, February 9, 2022

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program';
4          %LET _CLIENTPROCESSFLOWNAME='Cluster - Optimization';
5          %LET _CLIENTPROJECTPATH='C:\Users\up0j1eb\Desktop\SNP Simulations\Cut_point_simulation_20220203_AY003.egp';
6          %LET _CLIENTPROJECTPATHHOST='HPZ155CG0502B2G';
7          %LET _CLIENTPROJECTNAME='Cut_point_simulation_20220203_AY003.egp';
8          %LET _SASPROGRAMFILE='';
9          %LET _SASPROGRAMFILEHOST='';
10         
11         ODS _ALL_ CLOSE;
12         OPTIONS DEV=PNG;
13         GOPTIONS XPIXELS=0 YPIXELS=0;
14         FILENAME EGSR TEMP;
15         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
16             STYLE=HtmlBlue
17             STYLESHEET=(URL="file:///C:/Program%20Files%20(x86)/SASHome94/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")
18             NOGTITLE
19             NOGFOOTNOTE
20             GPATH=&amp;amp;sasworklocation
21             ENCODING=UTF8
22             options(rolap="on")
23         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
24         
25         GOPTIONS ACCESSIBLE;
ERROR: All positional parameters must precede keyword parameters.
26         
27         
28         %macro analysis(clustergrp = , finalf_ , finalMean= );
29         
30         data WORK.inclusterdat_random9;
31         	set &amp;amp;ClusterGrp.;
32         run;
33         
34         proc distance
35         	data=WORK.inclusterdat_random9
36         	out=distancedat
37         	method=Euclid;
38         	var interval(METRIC);
39         	id contract_id;
40         run;
41         
42         
43         proc cluster data=distancedat method=ward /*trim=1 k=3*/
44         	outtree=treedat noprint;
45         	id contract_id;
46         run;
47         
48         proc tree data=treedat ncl=5 horizontal out=outclusterdat noprint;
49         	id contract_id;
50         run;
51         
52         proc sql;
53         	CREATE TABLE WORK.JOIN AS
54         		SELECT a.*,
55         			b.METRIC
56         		FROM work.outclusterdat a INNER JOIN WORK.inclusterdat_random9 b
2                                                          The SAS System                          10:29 Wednesday, February 9, 2022

57         			ON a.contract_id = b.contract_id
58         		order by CLUSTER DESC;
59         
60         proc sql;
61         	CREATE TABLE &amp;amp;Finalf_. AS
62         		SELECT DISTINCT cluster,
63         			MIN(METRIC) AS LOWER_BOUND
64         		FROM WORK.JOIN
65         			WHERE cluster BETWEEN 1 AND 5
66         				GROUP BY cluster
67         					ORDER BY LOWER_BOUND ASC;
68         quit;
69         
70         %mend;
71         
72         /*Call macro multiple times:*/
73         
74         %analysis(ClusterGrp = Cluster1, Finalf_ = Final1, finalMean = DIAB001);
           _
           180
WARNING: Apparent invocation of macro ANALYSIS not resolved.

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
75         %analysis(ClusterGrp = Cluster2, Finalf_ = Final2, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
76         %analysis(ClusterGrp = Cluster3, Finalf_ = Final3, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
77         %analysis(ClusterGrp = Cluster4, Finalf_ = Final4, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
78         %analysis(ClusterGrp = Cluster5, Finalf_ = Final5, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
79         %analysis(ClusterGrp = Cluster6, Finalf_ = Final6, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.
3                                                          The SAS System                          10:29 Wednesday, February 9, 2022


WARNING: Apparent invocation of macro ANALYSIS not resolved.
80         %analysis(ClusterGrp = Cluster7, Finalf_ = Final7, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
81         %analysis(ClusterGrp = Cluster8, Finalf_ = Final8, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
82         %analysis(ClusterGrp = Cluster9, Finalf_ = Final9, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
83         %analysis(ClusterGrp = Cluster10, Finalf_ = Final10, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

84         
85         
86         
87         GOPTIONS NOACCESSIBLE;
88         %LET _CLIENTTASKLABEL=;
89         %LET _CLIENTPROCESSFLOWNAME=;
90         %LET _CLIENTPROJECTPATH=;
91         %LET _CLIENTPROJECTPATHHOST=;
92         %LET _CLIENTPROJECTNAME=;
93         %LET _SASPROGRAMFILE=;
94         %LET _SASPROGRAMFILEHOST=;
95         
96         ;*';*";*/;quit;run;
97         ODS _ALL_ CLOSE;
98         
99         
100        QUIT; RUN;
101        &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 09 Feb 2022 20:23:13 GMT</pubDate>
    <dc:creator>Esseny1</dc:creator>
    <dc:date>2022-02-09T20:23:13Z</dc:date>
    <item>
      <title>ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/795320#M255084</link>
      <description>&lt;PRE&gt;&lt;CODE class=""&gt;I am getting the following error when running the code below. Any help in debugging would be great &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1                                                          The SAS System                          10:29 Wednesday, February 9, 2022

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program';
4          %LET _CLIENTPROCESSFLOWNAME='Cluster - Optimization';
5          %LET _CLIENTPROJECTPATH='C:\Users\up0j1eb\Desktop\SNP Simulations\Cut_point_simulation_20220203_AY003.egp';
6          %LET _CLIENTPROJECTPATHHOST='HPZ155CG0502B2G';
7          %LET _CLIENTPROJECTNAME='Cut_point_simulation_20220203_AY003.egp';
8          %LET _SASPROGRAMFILE='';
9          %LET _SASPROGRAMFILEHOST='';
10         
11         ODS _ALL_ CLOSE;
12         OPTIONS DEV=PNG;
13         GOPTIONS XPIXELS=0 YPIXELS=0;
14         FILENAME EGSR TEMP;
15         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
16             STYLE=HtmlBlue
17             STYLESHEET=(URL="file:///C:/Program%20Files%20(x86)/SASHome94/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")
18             NOGTITLE
19             NOGFOOTNOTE
20             GPATH=&amp;amp;sasworklocation
21             ENCODING=UTF8
22             options(rolap="on")
23         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
24         
25         GOPTIONS ACCESSIBLE;
ERROR: All positional parameters must precede keyword parameters.
26         
27         
28         %macro analysis(clustergrp = , finalf_ , finalMean= );
29         
30         data WORK.inclusterdat_random9;
31         	set &amp;amp;ClusterGrp.;
32         run;
33         
34         proc distance
35         	data=WORK.inclusterdat_random9
36         	out=distancedat
37         	method=Euclid;
38         	var interval(METRIC);
39         	id contract_id;
40         run;
41         
42         
43         proc cluster data=distancedat method=ward /*trim=1 k=3*/
44         	outtree=treedat noprint;
45         	id contract_id;
46         run;
47         
48         proc tree data=treedat ncl=5 horizontal out=outclusterdat noprint;
49         	id contract_id;
50         run;
51         
52         proc sql;
53         	CREATE TABLE WORK.JOIN AS
54         		SELECT a.*,
55         			b.METRIC
56         		FROM work.outclusterdat a INNER JOIN WORK.inclusterdat_random9 b
2                                                          The SAS System                          10:29 Wednesday, February 9, 2022

57         			ON a.contract_id = b.contract_id
58         		order by CLUSTER DESC;
59         
60         proc sql;
61         	CREATE TABLE &amp;amp;Finalf_. AS
62         		SELECT DISTINCT cluster,
63         			MIN(METRIC) AS LOWER_BOUND
64         		FROM WORK.JOIN
65         			WHERE cluster BETWEEN 1 AND 5
66         				GROUP BY cluster
67         					ORDER BY LOWER_BOUND ASC;
68         quit;
69         
70         %mend;
71         
72         /*Call macro multiple times:*/
73         
74         %analysis(ClusterGrp = Cluster1, Finalf_ = Final1, finalMean = DIAB001);
           _
           180
WARNING: Apparent invocation of macro ANALYSIS not resolved.

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
75         %analysis(ClusterGrp = Cluster2, Finalf_ = Final2, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
76         %analysis(ClusterGrp = Cluster3, Finalf_ = Final3, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
77         %analysis(ClusterGrp = Cluster4, Finalf_ = Final4, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
78         %analysis(ClusterGrp = Cluster5, Finalf_ = Final5, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
79         %analysis(ClusterGrp = Cluster6, Finalf_ = Final6, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.
3                                                          The SAS System                          10:29 Wednesday, February 9, 2022


WARNING: Apparent invocation of macro ANALYSIS not resolved.
80         %analysis(ClusterGrp = Cluster7, Finalf_ = Final7, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
81         %analysis(ClusterGrp = Cluster8, Finalf_ = Final8, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
82         %analysis(ClusterGrp = Cluster9, Finalf_ = Final9, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro ANALYSIS not resolved.
83         %analysis(ClusterGrp = Cluster10, Finalf_ = Final10, finalMean = DIAB001);
           _
           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

84         
85         
86         
87         GOPTIONS NOACCESSIBLE;
88         %LET _CLIENTTASKLABEL=;
89         %LET _CLIENTPROCESSFLOWNAME=;
90         %LET _CLIENTPROJECTPATH=;
91         %LET _CLIENTPROJECTPATHHOST=;
92         %LET _CLIENTPROJECTNAME=;
93         %LET _SASPROGRAMFILE=;
94         %LET _SASPROGRAMFILEHOST=;
95         
96         ;*';*";*/;quit;run;
97         ODS _ALL_ CLOSE;
98         
99         
100        QUIT; RUN;
101        &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Feb 2022 20:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/795320#M255084</guid>
      <dc:creator>Esseny1</dc:creator>
      <dc:date>2022-02-09T20:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/795322#M255085</link>
      <description>&lt;P&gt;SAS does not know about any macro named %ANALYSIS, as far as SAS is concerned this macro doesn't exist.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where did you see this %ANALYSIS macro? You have to include the macro in your code somehow before you call it, the easiest way is to copy the macro code from wherever you saw it, and paste it into your code at the top, and then run the whole thing again.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 20:30:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/795322#M255085</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-02-09T20:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/795333#M255093</link>
      <description>&lt;P&gt;The specific error message relates to&lt;/P&gt;
&lt;PRE&gt;ERROR: All positional parameters must precede keyword parameters.
26         
27         
28         %macro analysis(clustergrp = , finalf_ , finalMean= );&lt;/PRE&gt;
&lt;P&gt;Positional parameters are those that the definition relies on position in the parameter list to assign values and not defined with an =. As such Finalf_ is positional but comes after the keyword parameter clustergrp. With that error no macro was compiled so it cannot be used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change the definition to&lt;/P&gt;
&lt;PRE&gt;        
  %macro analysis(clustergrp = , finalf_= , finalMean= );&lt;/PRE&gt;
&lt;P&gt;and at least the first error message should go away.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 21:00:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/795333#M255093</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-02-09T21:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/795341#M255099</link>
      <description>&lt;P&gt;The SAS error detector can see into the future, it knew two lines before you typed the %MACRO statement that you were going to make a mistake.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ERROR: All positional parameters must precede keyword parameters.
26         
27         
28         %macro analysis(clustergrp = , finalf_ , finalMean= );
29         &lt;/PRE&gt;
&lt;P&gt;or perhaps it just does a poor job of placing the error message at the point where the error actually is.&lt;/P&gt;
&lt;P&gt;Either add an equal sign after FINALF_ .&lt;/P&gt;
&lt;P&gt;Or remove the equal sign after CLUSTERGRP.&lt;/P&gt;
&lt;P&gt;So that all of the POSITIONAL parameters are defined before any NAMED parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note you can still pass the values by name in the call to the macro even if you defined the macro to allow you to pass the values by position.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 21:18:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/795341#M255099</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-09T21:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 180-322: Statement is not valid or it is used out of proper order.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/795360#M255115</link>
      <description>&lt;P&gt;Code/related question is here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Iteration-to-change-macro-names/m-p/795268" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Iteration-to-change-macro-names/m-p/795268&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 21:50:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-180-322-Statement-is-not-valid-or-it-is-used-out-of-proper/m-p/795360#M255115</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-02-09T21:50:14Z</dc:date>
    </item>
  </channel>
</rss>

