<?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 about coding Categorical variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-about-coding-Categorical-variable/m-p/353005#M82362</link>
    <description>&lt;P&gt;This section of the program looks OK.&amp;nbsp; The problem might lie in another section of the program, or it might lie in the data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&amp;nbsp; The data actually contains all uppercase values for SMOKE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&amp;nbsp; The number of characters in SMOKE is actually less than 10 (for whatever reason).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&amp;nbsp; The DATA step that contains this code forgot to use a SET statement to read in the data source.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The steps you can take to help:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run a PROC FREQ on the variable SMOKE to verify the actual values it contains.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post the log from your DATA step (not the program).&amp;nbsp; That will contain key results to help diagnose the source of the problem.&lt;/P&gt;</description>
    <pubDate>Mon, 24 Apr 2017 20:36:43 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-04-24T20:36:43Z</dc:date>
    <item>
      <title>Question about coding Categorical variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-coding-Categorical-variable/m-p/353003#M82360</link>
      <description>&lt;P&gt;I've got a dataset imported from SPSS. The smoking status from patients is coded as "smoke" variable. And it has 3 categories&amp;nbsp;"Current smoker", "Ex smoker" and "Non-smoker". I wanted to code this categorical variable into 0, 1, 2 so&amp;nbsp;I wrote below code. However, it did not work. It is showing "." in each column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if smoke='Current smoker' then smoke1=2;&lt;BR /&gt;else if smoke='Ex smoker' then smoke1=1;&lt;BR /&gt;else if smoke='Non-smoker' then smoke1=0;&lt;BR /&gt;else if smoke='No Answer' then smoke1=.;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 20:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-coding-Categorical-variable/m-p/353003#M82360</guid>
      <dc:creator>Denali</dc:creator>
      <dc:date>2017-04-24T20:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Question about coding Categorical variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-coding-Categorical-variable/m-p/353005#M82362</link>
      <description>&lt;P&gt;This section of the program looks OK.&amp;nbsp; The problem might lie in another section of the program, or it might lie in the data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&amp;nbsp; The data actually contains all uppercase values for SMOKE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&amp;nbsp; The number of characters in SMOKE is actually less than 10 (for whatever reason).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&amp;nbsp; The DATA step that contains this code forgot to use a SET statement to read in the data source.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The steps you can take to help:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run a PROC FREQ on the variable SMOKE to verify the actual values it contains.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post the log from your DATA step (not the program).&amp;nbsp; That will contain key results to help diagnose the source of the problem.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 20:36:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-coding-Categorical-variable/m-p/353005#M82362</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-04-24T20:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: Question about coding Categorical variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-coding-Categorical-variable/m-p/353014#M82367</link>
      <description>&lt;P&gt;Please run Proc Contents on that data set and share the results for the smoke variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you say you get . it may mean that smoke is already numeric and you perhaps are seeing a Format applied to an existing numeric value.&lt;/P&gt;
&lt;P&gt;Or try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=&amp;lt;your data set name&amp;gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; tables smoke;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; format smoke best.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 21:23:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-coding-Categorical-variable/m-p/353014#M82367</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-04-24T21:23:00Z</dc:date>
    </item>
  </channel>
</rss>

