<?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 How do I solve Error: Statement is not valid or it is used out of proper order.  (and make loops in) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-solve-Error-Statement-is-not-valid-or-it-is-used-out-of/m-p/348168#M80591</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I am completely new to SAS. You can see my code below. When I run the last part, I get the error message: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;94 &amp;nbsp;95 &amp;nbsp;96 Proc sgplot data = pred; &amp;nbsp;97 plot p * x_1 = x_2 / vaxis = Axis1 haxis = Axis2; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;____ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;180 &amp;nbsp;ERROR 180-322: Statement is not valid or it is used out of proper order. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Why is that? How do I solve it? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I also wonder how I can run the same code for several different samples, lets say 300 different samples. Can I make a loop for this and how do I do that? (SAS® Studio university edition)&amp;nbsp;&lt;/SPAN&gt;&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;PROC IMPORT DATAFILE=REFFILE&lt;BR /&gt;DBMS=DBF&lt;BR /&gt;OUT=WORK.IMPORT1;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc freq data = WORK.IMPORT1;&lt;BR /&gt;tables x_1*(x_2 ytest);&lt;BR /&gt;tables x_2*ytest;&lt;BR /&gt;weight num;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc tabulate data = WORK.IMPORT1;&lt;BR /&gt;class x_1 x_2 ytest;&lt;BR /&gt;tables x_1='x_1', ytest*x_2='x_2'*F=6. / rts=13.;&lt;BR /&gt;freq num;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc logistic data = WORK.IMPORT1 desc;&lt;BR /&gt;class x_1 x_2 ytest;&lt;BR /&gt;freq num;&lt;BR /&gt;model ytest = x_1 x_2;&lt;BR /&gt;exact x_1 x_2 / estimate = both;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc logistic data = WORK.IMPORT1 desc;&lt;BR /&gt;class x_1 x_2 ytest;&lt;BR /&gt;freq num;&lt;BR /&gt;model ytest = x_1 x_2;&lt;BR /&gt;exact x_1 x_2 / estimate = both;&lt;BR /&gt;output out = pred predicted = p;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;symbol1 c=blue v=circle i=join;&lt;BR /&gt;symbol2 c=red v=plus i=join;&lt;BR /&gt;symbol3 c=black v=square i=join;&lt;BR /&gt;axis1 label=(r=0 a=90) minor=none;&lt;BR /&gt;axis2 minor=none order=(0 1);&lt;BR /&gt;proc sgplot data= pred;&lt;BR /&gt;plot p*x_1=x_2 / vaxis=axis1 haxis=axis2;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Apr 2017 15:38:13 GMT</pubDate>
    <dc:creator>gretaolsson</dc:creator>
    <dc:date>2017-04-07T15:38:13Z</dc:date>
    <item>
      <title>How do I solve Error: Statement is not valid or it is used out of proper order.  (and make loops in)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-solve-Error-Statement-is-not-valid-or-it-is-used-out-of/m-p/348168#M80591</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I am completely new to SAS. You can see my code below. When I run the last part, I get the error message: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;94 &amp;nbsp;95 &amp;nbsp;96 Proc sgplot data = pred; &amp;nbsp;97 plot p * x_1 = x_2 / vaxis = Axis1 haxis = Axis2; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;____ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;180 &amp;nbsp;ERROR 180-322: Statement is not valid or it is used out of proper order. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Why is that? How do I solve it? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I also wonder how I can run the same code for several different samples, lets say 300 different samples. Can I make a loop for this and how do I do that? (SAS® Studio university edition)&amp;nbsp;&lt;/SPAN&gt;&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;PROC IMPORT DATAFILE=REFFILE&lt;BR /&gt;DBMS=DBF&lt;BR /&gt;OUT=WORK.IMPORT1;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc freq data = WORK.IMPORT1;&lt;BR /&gt;tables x_1*(x_2 ytest);&lt;BR /&gt;tables x_2*ytest;&lt;BR /&gt;weight num;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc tabulate data = WORK.IMPORT1;&lt;BR /&gt;class x_1 x_2 ytest;&lt;BR /&gt;tables x_1='x_1', ytest*x_2='x_2'*F=6. / rts=13.;&lt;BR /&gt;freq num;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc logistic data = WORK.IMPORT1 desc;&lt;BR /&gt;class x_1 x_2 ytest;&lt;BR /&gt;freq num;&lt;BR /&gt;model ytest = x_1 x_2;&lt;BR /&gt;exact x_1 x_2 / estimate = both;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc logistic data = WORK.IMPORT1 desc;&lt;BR /&gt;class x_1 x_2 ytest;&lt;BR /&gt;freq num;&lt;BR /&gt;model ytest = x_1 x_2;&lt;BR /&gt;exact x_1 x_2 / estimate = both;&lt;BR /&gt;output out = pred predicted = p;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;symbol1 c=blue v=circle i=join;&lt;BR /&gt;symbol2 c=red v=plus i=join;&lt;BR /&gt;symbol3 c=black v=square i=join;&lt;BR /&gt;axis1 label=(r=0 a=90) minor=none;&lt;BR /&gt;axis2 minor=none order=(0 1);&lt;BR /&gt;proc sgplot data= pred;&lt;BR /&gt;plot p*x_1=x_2 / vaxis=axis1 haxis=axis2;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 15:38:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-solve-Error-Statement-is-not-valid-or-it-is-used-out-of/m-p/348168#M80591</guid>
      <dc:creator>gretaolsson</dc:creator>
      <dc:date>2017-04-07T15:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I solve Error: Statement is not valid or it is used out of proper order.  (and make loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-solve-Error-Statement-is-not-valid-or-it-is-used-out-of/m-p/348197#M80605</link>
      <description>&lt;P&gt;With errors it is best to post the code and error from log both and paste into a code box opened with the forum {i] menu icon.&lt;/P&gt;
&lt;P&gt;The error message often includes a postional indicator but the main message window will reformat text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But part of your issue is that the HAXIS and VAXIS are not valid for SGPLOT. Did you mean to use Proc GPLOT?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should expand on what you mean by "300 samples". If you have a variable, or combination of variables, that describes groups of records that you want processed together then BY group processing is likely what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you mean diffent variables in models and such then likely need to get more details. I suspect an approach with a control dataset containing the variable names as parameters and Call Execute using those parameters would work.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 16:33:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-solve-Error-Statement-is-not-valid-or-it-is-used-out-of/m-p/348197#M80605</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-04-07T16:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I solve Error: Statement is not valid or it is used out of proper order.  (and make loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-solve-Error-Statement-is-not-valid-or-it-is-used-out-of/m-p/348206#M80609</link>
      <description>&lt;P&gt;For PROC SGPLOT, you specify the type of plot you want, and then use keyword-value pairs to specify the variables for each role. &amp;nbsp;For example, to get a scatter plot of weight vs height with markers colored by the values of Sex variable, you would say&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgplot data=sashelp.class;&lt;BR /&gt;scatter x=height y=weight / group=sex markerattrs=(symbol=CircleFilled);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's a completely different syntax. You might want to&lt;A href="https://support.sas.com/sassamples/graphgallery/PROC_SGPLOT.html" target="_self"&gt; look at the ODS Graphics Gallery for examples and code.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 17:01:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-solve-Error-Statement-is-not-valid-or-it-is-used-out-of/m-p/348206#M80609</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-04-07T17:01:31Z</dc:date>
    </item>
  </channel>
</rss>

