<?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 Unable to create a new variable in sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-create-a-new-variable-in-sas/m-p/778968#M248033</link>
    <description>&lt;P&gt;Hi. I have the following code in SAS&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;

input Make $ Model $ Type $ Origin $ DriveTrain $ MSRP Invoice;
datalines;
Acura MDX SUV Asia All 36945 33337
BMW X3 SUV Europe All 37000 33873
BMW 325i Sedan Europe All 52195 47720
Dodge Durango SUV USA All 32235 29472
Dodge Neon Sedan USA Front 13670 12849
;

pct_change = (MSRP - Invoice)/Invoice;
format pct_change percent10.;
where Type = "SUV" and DriveTrain = "All";
run;

proc print data = have;
title 'All wheel drive SUVs with less than 10% change in Price';
var Make Model MSRP Invoice pct_change;
where pct_change le 0.1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and I'm receiving the following errors&lt;/P&gt;
&lt;PRE&gt;80         pct_change = (MSRP - Invoice)/Invoice;
            __________
            180
 
 ERROR 180-322: Statement is not valid or it is used out of proper order.
&lt;/PRE&gt;
&lt;P&gt;I don't know what I have done wrong and this should be a simple code so it really confused me. Any help? Thank you in advance!&lt;/P&gt;</description>
    <pubDate>Sun, 07 Nov 2021 07:54:45 GMT</pubDate>
    <dc:creator>aabbccwyt</dc:creator>
    <dc:date>2021-11-07T07:54:45Z</dc:date>
    <item>
      <title>Unable to create a new variable in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-create-a-new-variable-in-sas/m-p/778968#M248033</link>
      <description>&lt;P&gt;Hi. I have the following code in SAS&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;

input Make $ Model $ Type $ Origin $ DriveTrain $ MSRP Invoice;
datalines;
Acura MDX SUV Asia All 36945 33337
BMW X3 SUV Europe All 37000 33873
BMW 325i Sedan Europe All 52195 47720
Dodge Durango SUV USA All 32235 29472
Dodge Neon Sedan USA Front 13670 12849
;

pct_change = (MSRP - Invoice)/Invoice;
format pct_change percent10.;
where Type = "SUV" and DriveTrain = "All";
run;

proc print data = have;
title 'All wheel drive SUVs with less than 10% change in Price';
var Make Model MSRP Invoice pct_change;
where pct_change le 0.1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and I'm receiving the following errors&lt;/P&gt;
&lt;PRE&gt;80         pct_change = (MSRP - Invoice)/Invoice;
            __________
            180
 
 ERROR 180-322: Statement is not valid or it is used out of proper order.
&lt;/PRE&gt;
&lt;P&gt;I don't know what I have done wrong and this should be a simple code so it really confused me. Any help? Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Sun, 07 Nov 2021 07:54:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-create-a-new-variable-in-sas/m-p/778968#M248033</guid>
      <dc:creator>aabbccwyt</dc:creator>
      <dc:date>2021-11-07T07:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to create a new variable in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-create-a-new-variable-in-sas/m-p/778969#M248034</link>
      <description>&lt;P&gt;Compare below syntactically working code to your version and you should understand where you've got it wrong.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input Make $ Model $ Type $ Origin $ DriveTrain $ MSRP Invoice;
  pct_change = (MSRP - Invoice)/Invoice;
  format pct_change percent10.;
  if Type = "SUV" and DriveTrain = "All";
  datalines;
Acura MDX SUV Asia All 36945 33337
BMW X3 SUV Europe All 37000 33873
BMW 325i Sedan Europe All 52195 47720
Dodge Durango SUV USA All 32235 29472
Dodge Neon Sedan USA Front 13670 12849
;

proc print data = have;
  title 'All wheel drive SUVs with less than 10% change in Price';
  var Make Model MSRP Invoice pct_change;
  where pct_change le 0.1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 07 Nov 2021 08:06:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-create-a-new-variable-in-sas/m-p/778969#M248034</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-11-07T08:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to create a new variable in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-create-a-new-variable-in-sas/m-p/778971#M248036</link>
      <description>&lt;P&gt;You need to understand what DATALINES does, so you have to &lt;EM&gt;Read the Documentation&lt;/EM&gt; (Maxim 1):&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lestmtsref/p0114gachtut3nn1and4ap8ke9nf.htm" target="_blank" rel="noopener"&gt;DATALINES Statement&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Nov 2021 08:54:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-create-a-new-variable-in-sas/m-p/778971#M248036</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-07T08:54:02Z</dc:date>
    </item>
  </channel>
</rss>

