<?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: How to? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to/m-p/38729#M9977</link>
    <description>Hi:&lt;BR /&gt;
  As an alternative, I like the PROC FORMAT approach.&lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data rates;&lt;BR /&gt;
  infile datalines;&lt;BR /&gt;
  input year state $ rate comma8. ;&lt;BR /&gt;
return;&lt;BR /&gt;
datalines;&lt;BR /&gt;
2009 MA $150&lt;BR /&gt;
2009 NH $80&lt;BR /&gt;
2009 ME $55&lt;BR /&gt;
2010 MA $155&lt;BR /&gt;
2010 NH $87&lt;BR /&gt;
2010 ME $60&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
                   &lt;BR /&gt;
proc format;&lt;BR /&gt;
  value $rmult '2009MA' = '2'&lt;BR /&gt;
               '2009NH' = '3'&lt;BR /&gt;
               '2009ME' = '4'&lt;BR /&gt;
               '2010MA' = '1.5'&lt;BR /&gt;
               '2010NH' = '2'&lt;BR /&gt;
               '2010ME' = '2.5';&lt;BR /&gt;
run;&lt;BR /&gt;
                       &lt;BR /&gt;
data newrate;&lt;BR /&gt;
  length testval $6;&lt;BR /&gt;
  set rates;&lt;BR /&gt;
  testval = catt(put(year,4.0),state);&lt;BR /&gt;
  mult = input(put(testval,$rmult.),best8.);&lt;BR /&gt;
  newrate = rate * mult;&lt;BR /&gt;
run;&lt;BR /&gt;
  &lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc print data=newrate;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Sat, 26 Mar 2011 00:38:00 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2011-03-26T00:38:00Z</dc:date>
    <item>
      <title>How to?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to/m-p/38726#M9974</link>
      <description>Hi, I have very limited knowledge of SAS and looking for help:&lt;BR /&gt;
I have 3 col in table: &lt;BR /&gt;
&lt;BR /&gt;
Year, State and Rate &lt;BR /&gt;
2009  MA     $150&lt;BR /&gt;
2009  NH       $80&lt;BR /&gt;
2009  ME      $55&lt;BR /&gt;
2010  MA     $155&lt;BR /&gt;
2010  NH       $87&lt;BR /&gt;
2010  ME      $60&lt;BR /&gt;
&lt;BR /&gt;
I need to change the current Rates according to this statement:&lt;BR /&gt;
&lt;BR /&gt;
if Year = 2009 and state is MA - Rate * 2&lt;BR /&gt;
if Year = 2009 and state is NH - Rate * 3&lt;BR /&gt;
if Year = 2009 and state is ME - Rate * 4&lt;BR /&gt;
if Year = 2010 and state is MA - Rate * 1.5&lt;BR /&gt;
if Year = 2010 and state is NH - Rate * 2&lt;BR /&gt;
if Year = 2010 and state is ME - Rate * 2.5&lt;BR /&gt;
&lt;BR /&gt;
Any ideas? Thank you</description>
      <pubDate>Fri, 25 Mar 2011 23:46:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to/m-p/38726#M9974</guid>
      <dc:creator>putnik</dc:creator>
      <dc:date>2011-03-25T23:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to/m-p/38727#M9975</link>
      <description>data sample_data;&lt;BR /&gt;
infile datalines;&lt;BR /&gt;
input year state $  rate;&lt;BR /&gt;
datalines;&lt;BR /&gt;
2009 MA 150&lt;BR /&gt;
2009 NH 80&lt;BR /&gt;
2009 ME 55&lt;BR /&gt;
2010 MA 155&lt;BR /&gt;
2010 NH 87&lt;BR /&gt;
2010 ME 60&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data modify;&lt;BR /&gt;
set sample_data;&lt;BR /&gt;
&lt;BR /&gt;
	select(state);&lt;BR /&gt;
		when ('MA') do;&lt;BR /&gt;
			if year=2009 then rate=rate*2;&lt;BR /&gt;
			else if year=2010 then rate=rate*1.5;&lt;BR /&gt;
		end;&lt;BR /&gt;
		when ('NH') do;&lt;BR /&gt;
			if year=2009 then rate=rate*3;&lt;BR /&gt;
			else if year=2010 then rate=rate*2;&lt;BR /&gt;
		end;&lt;BR /&gt;
		when ('ME') do;&lt;BR /&gt;
			if year=2009 then rate=rate*3;&lt;BR /&gt;
			else if year=2010 then rate=rate*2.5;&lt;BR /&gt;
		end;&lt;BR /&gt;
		otherwise;&lt;BR /&gt;
	end;&lt;BR /&gt;
&lt;BR /&gt;
run;</description>
      <pubDate>Sat, 26 Mar 2011 00:17:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to/m-p/38727#M9975</guid>
      <dc:creator>AndyJ</dc:creator>
      <dc:date>2011-03-26T00:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to/m-p/38728#M9976</link>
      <description>Thank you so much!</description>
      <pubDate>Sat, 26 Mar 2011 00:24:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to/m-p/38728#M9976</guid>
      <dc:creator>putnik</dc:creator>
      <dc:date>2011-03-26T00:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to/m-p/38729#M9977</link>
      <description>Hi:&lt;BR /&gt;
  As an alternative, I like the PROC FORMAT approach.&lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data rates;&lt;BR /&gt;
  infile datalines;&lt;BR /&gt;
  input year state $ rate comma8. ;&lt;BR /&gt;
return;&lt;BR /&gt;
datalines;&lt;BR /&gt;
2009 MA $150&lt;BR /&gt;
2009 NH $80&lt;BR /&gt;
2009 ME $55&lt;BR /&gt;
2010 MA $155&lt;BR /&gt;
2010 NH $87&lt;BR /&gt;
2010 ME $60&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
                   &lt;BR /&gt;
proc format;&lt;BR /&gt;
  value $rmult '2009MA' = '2'&lt;BR /&gt;
               '2009NH' = '3'&lt;BR /&gt;
               '2009ME' = '4'&lt;BR /&gt;
               '2010MA' = '1.5'&lt;BR /&gt;
               '2010NH' = '2'&lt;BR /&gt;
               '2010ME' = '2.5';&lt;BR /&gt;
run;&lt;BR /&gt;
                       &lt;BR /&gt;
data newrate;&lt;BR /&gt;
  length testval $6;&lt;BR /&gt;
  set rates;&lt;BR /&gt;
  testval = catt(put(year,4.0),state);&lt;BR /&gt;
  mult = input(put(testval,$rmult.),best8.);&lt;BR /&gt;
  newrate = rate * mult;&lt;BR /&gt;
run;&lt;BR /&gt;
  &lt;BR /&gt;
ods listing;&lt;BR /&gt;
proc print data=newrate;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Sat, 26 Mar 2011 00:38:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to/m-p/38729#M9977</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-03-26T00:38:00Z</dc:date>
    </item>
  </channel>
</rss>

