<?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: Question with SAS comparison operators in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Question-with-SAS-comparison-operators/m-p/32503#M7833</link>
    <description>And one more, "=" sign missing in that line.&lt;BR /&gt;
&lt;BR /&gt;
Should be:&lt;BR /&gt;
&lt;BR /&gt;
if populationmunicipality LT= 10000 then group='rural';&lt;BR /&gt;
else group='urban';</description>
    <pubDate>Fri, 18 Mar 2011 08:49:58 GMT</pubDate>
    <dc:creator>ieva</dc:creator>
    <dc:date>2011-03-18T08:49:58Z</dc:date>
    <item>
      <title>Question with SAS comparison operators</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Question-with-SAS-comparison-operators/m-p/32501#M7831</link>
      <description>I am using SAS for the first time.&lt;BR /&gt;
&lt;BR /&gt;
My input data is:&lt;BR /&gt;
input personid annualearnings sex $ schooling ftwe populationmunicipality;&lt;BR /&gt;
cards;&lt;BR /&gt;
1 55000 male 12 10 88000&lt;BR /&gt;
2 67000 male 16 8 66000&lt;BR /&gt;
......etc.&lt;BR /&gt;
&lt;BR /&gt;
This is working fine. But I'm trying to calculate the mean, standard deviation, and standard error of the mean for earnings, a female binary variable, schooling, experience (ftwe), and a rural binary variable (a rural area is one where fewer than 10,000 people reside); then repeat this, but by sex (for all the other variables in this list).&lt;BR /&gt;
&lt;BR /&gt;
When I set my first binary variable (sex = female) I have no problem running it. But if I try adding a second binary variable for population municipality, I don't know how to do it as I keep receiving error messages (see below). Am I defining it the wrong way? I have tried several different methods, but I am not sure what to do next.... Help?  Thanks!!!&lt;BR /&gt;
&lt;BR /&gt;
data out.permanent(keep = annualearnings log_annualearnings female schooling ftwe populationmunicipality);&lt;BR /&gt;
set temp(drop = personid);&lt;BR /&gt;
&lt;BR /&gt;
where (annualearnings^=. and sex^=" " and schooling^=. and ftwe^=. and populationmunicipality^=.);&lt;BR /&gt;
&lt;BR /&gt;
log_annualearnings=log(annualearnings);&lt;BR /&gt;
&lt;BR /&gt;
if sex="female" then female=1;&lt;BR /&gt;
else if sex="male" then female=0;&lt;BR /&gt;
&lt;BR /&gt;
if populationmunicipality LT 10000, then group='rural';&lt;BR /&gt;
else group='urban'&lt;BR /&gt;
&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 17 Mar 2011 22:24:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Question-with-SAS-comparison-operators/m-p/32501#M7831</guid>
      <dc:creator>Mimo</dc:creator>
      <dc:date>2011-03-17T22:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Question with SAS comparison operators</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Question-with-SAS-comparison-operators/m-p/32502#M7832</link>
      <description>You've got some syntax errors in your last two lines:&lt;BR /&gt;
&lt;BR /&gt;
if populationmunicipality LT 10000, then group='rural';&lt;BR /&gt;
else group='urban'&lt;BR /&gt;
&lt;BR /&gt;
An extra comma and no semicolon after the last line. &lt;BR /&gt;
&lt;BR /&gt;
You should look up proc means though, using by groups specifically. You don't necessarily have to recode your text categories into binary variables in SAS.</description>
      <pubDate>Fri, 18 Mar 2011 00:36:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Question-with-SAS-comparison-operators/m-p/32502#M7832</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2011-03-18T00:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Question with SAS comparison operators</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Question-with-SAS-comparison-operators/m-p/32503#M7833</link>
      <description>And one more, "=" sign missing in that line.&lt;BR /&gt;
&lt;BR /&gt;
Should be:&lt;BR /&gt;
&lt;BR /&gt;
if populationmunicipality LT= 10000 then group='rural';&lt;BR /&gt;
else group='urban';</description>
      <pubDate>Fri, 18 Mar 2011 08:49:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Question-with-SAS-comparison-operators/m-p/32503#M7833</guid>
      <dc:creator>ieva</dc:creator>
      <dc:date>2011-03-18T08:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Question with SAS comparison operators</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Question-with-SAS-comparison-operators/m-p/32504#M7834</link>
      <description>Isn't LE the accepted mnemonic for "less than or equal to" rather than "LT="?</description>
      <pubDate>Fri, 18 Mar 2011 13:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Question-with-SAS-comparison-operators/m-p/32504#M7834</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2011-03-18T13:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Question with SAS comparison operators</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Question-with-SAS-comparison-operators/m-p/32505#M7835</link>
      <description>If you are going to make lots of dichotomous 1/0 variables the following may help.&lt;BR /&gt;
&lt;BR /&gt;
Female = (Sex = 'female');&lt;BR /&gt;
&lt;BR /&gt;
Though I would probably write:&lt;BR /&gt;
&lt;BR /&gt;
Female = (Upcase(Sex) = 'FEMALE');&lt;BR /&gt;
&lt;BR /&gt;
SAS treats "true" responses as 1 and false as 0.&lt;BR /&gt;
&lt;BR /&gt;
Care needs to be taken with this approach and LT or LE comparisons as missing values will be true as missing is the smallest "value" SAS understands.</description>
      <pubDate>Fri, 18 Mar 2011 16:38:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Question-with-SAS-comparison-operators/m-p/32505#M7835</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2011-03-18T16:38:15Z</dc:date>
    </item>
  </channel>
</rss>

