<?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: What is wrong with this? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-is-wrong-with-this/m-p/23685#M3945</link>
    <description>First, your do loop is not defined well for SAS.  You can just write&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
do i=1 to 14;&lt;BR /&gt;
  "Do stuff here"&lt;BR /&gt;
end;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Another thing is that macro variables can't be used within the same data step that they are created.&lt;BR /&gt;
&lt;BR /&gt;
Arrays would probably do what it looks like you are trying to do.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data new;&lt;BR /&gt;
  set old;&lt;BR /&gt;
  array Exp(14);&lt;BR /&gt;
  do i=1 to 14;&lt;BR /&gt;
    if Post in ('010') then Exp(i)=Price;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
But then you will just get 14 colums with the same value.  Maybe you could try and explain what you want to do.</description>
    <pubDate>Wed, 27 Oct 2010 13:51:47 GMT</pubDate>
    <dc:creator>RickM</dc:creator>
    <dc:date>2010-10-27T13:51:47Z</dc:date>
    <item>
      <title>What is wrong with this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-wrong-with-this/m-p/23681#M3941</link>
      <description>do i=1 to i&amp;lt;=14;&lt;BR /&gt;
x=i;&lt;BR /&gt;
call symput('j',x);&lt;BR /&gt;
if &lt;BR /&gt;
/*blablablabla*/&lt;BR /&gt;
then Exp&amp;amp;j=Price;&lt;BR /&gt;
&lt;BR /&gt;
i=i+1;&lt;BR /&gt;
end;&lt;BR /&gt;
&lt;BR /&gt;
I get the error message:&lt;BR /&gt;
(for the Exp&amp;amp;j=Price statement I have used.)&lt;BR /&gt;
ERROR 180-322: Statement is not valid or it is used out of proper order.</description>
      <pubDate>Wed, 27 Oct 2010 12:41:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-wrong-with-this/m-p/23681#M3941</guid>
      <dc:creator>nidhi123</dc:creator>
      <dc:date>2010-10-27T12:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-wrong-with-this/m-p/23682#M3942</link>
      <description>Here is my question. Something wrong with this forum today??&lt;BR /&gt;
&lt;BR /&gt;
do i=1 to i&amp;lt;=14;&lt;BR /&gt;
x=i;&lt;BR /&gt;
call symput('j',x);&lt;BR /&gt;
if &lt;BR /&gt;
/*blablablabla*/&lt;BR /&gt;
then Exp&amp;amp;j=Price;&lt;BR /&gt;
&lt;BR /&gt;
i=i+1;&lt;BR /&gt;
end;&lt;BR /&gt;
&lt;BR /&gt;
I get the error message:&lt;BR /&gt;
(for the Exp&amp;amp;j=Price statement I have used.)&lt;BR /&gt;
ERROR 180-322: Statement is not valid or it is used out of proper order.</description>
      <pubDate>Wed, 27 Oct 2010 12:41:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-wrong-with-this/m-p/23682#M3942</guid>
      <dc:creator>nidhi123</dc:creator>
      <dc:date>2010-10-27T12:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-wrong-with-this/m-p/23683#M3943</link>
      <description>Probably you have &amp;lt; or &amp;gt; in your code. &lt;A href="http://support.sas.com/forums/message.jspa?messageID=43785#43785" target="_blank"&gt;Here's&lt;/A&gt; how to post code in this forum.</description>
      <pubDate>Wed, 27 Oct 2010 13:14:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-wrong-with-this/m-p/23683#M3943</guid>
      <dc:creator>Tim_SAS</dc:creator>
      <dc:date>2010-10-27T13:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-wrong-with-this/m-p/23684#M3944</link>
      <description>THANKS TIM@SAS! &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Here is my problem:&lt;BR /&gt;
I get this error:&lt;BR /&gt;
&lt;BR /&gt;
Statement is not valid or it is used out of proper order.&lt;BR /&gt;
&lt;BR /&gt;
for running this code:&lt;BR /&gt;
&lt;BR /&gt;
DATA new;&lt;BR /&gt;
set old;&lt;BR /&gt;
do i=1 to i&amp;lt;=14;&lt;BR /&gt;
x=i;&lt;BR /&gt;
call symput('j',x);&lt;BR /&gt;
if Post in ('010')&lt;BR /&gt;
then Exp&amp;amp;j=Price;&lt;BR /&gt;
&lt;BR /&gt;
i=i+1;&lt;BR /&gt;
end;&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
SAS dont like me setting Exp&amp;amp;j = Price</description>
      <pubDate>Wed, 27 Oct 2010 13:32:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-wrong-with-this/m-p/23684#M3944</guid>
      <dc:creator>nidhi123</dc:creator>
      <dc:date>2010-10-27T13:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-wrong-with-this/m-p/23685#M3945</link>
      <description>First, your do loop is not defined well for SAS.  You can just write&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
do i=1 to 14;&lt;BR /&gt;
  "Do stuff here"&lt;BR /&gt;
end;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Another thing is that macro variables can't be used within the same data step that they are created.&lt;BR /&gt;
&lt;BR /&gt;
Arrays would probably do what it looks like you are trying to do.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data new;&lt;BR /&gt;
  set old;&lt;BR /&gt;
  array Exp(14);&lt;BR /&gt;
  do i=1 to 14;&lt;BR /&gt;
    if Post in ('010') then Exp(i)=Price;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
But then you will just get 14 colums with the same value.  Maybe you could try and explain what you want to do.</description>
      <pubDate>Wed, 27 Oct 2010 13:51:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-wrong-with-this/m-p/23685#M3945</guid>
      <dc:creator>RickM</dc:creator>
      <dc:date>2010-10-27T13:51:47Z</dc:date>
    </item>
  </channel>
</rss>

