<?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: Conditional coding in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265428#M7314</link>
    <description>&lt;P&gt;Thank you &lt;SPAN class="login-bold"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733" target="_self"&gt;FreelanceReinhard&lt;/A&gt;, please n&lt;/SPAN&gt;ote that histology_icdo3 is a character value too with a length of exactly 4 for all&amp;nbsp;&lt;SPAN&gt;of them.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Apr 2016 14:18:29 GMT</pubDate>
    <dc:creator>mayasak</dc:creator>
    <dc:date>2016-04-21T14:18:29Z</dc:date>
    <item>
      <title>Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265225#M7309</link>
      <description>&lt;P&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;Hello,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;I have a dataset about cancer. SEER has some conditions in defining brain tumors as benign. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;For other tumors such as breast, cervix, and other cancers I used:&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;if Seer_site_group in ( 26000 ) and beh=2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;then CASite67= 1901 ; *Breast, In Situ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;if Seer_site_group in ( 26000 ) and beh=3&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;then CASite67= 1902 ; *Breast, Malignant;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;if Seer_site_group in ( 27010 )&lt;BR /&gt;then CASite67= 2000 ; *Cervix;&lt;BR /&gt;if Seer_site_group in ( 27020)&lt;BR /&gt;then CASite67= 2101 ; *Corpus Uteri;&lt;BR /&gt;if Seer_site_group in ( 27030 )&lt;BR /&gt;then CASite67= 2102 ; *Uteri, NOS;&lt;BR /&gt;if Seer_site_group in ( 27040 )&lt;BR /&gt;then CASite67= 2200 ; *Ovary;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;For brain&amp;nbsp;cancer&amp;nbsp;I used:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;&lt;SPAN&gt;if Seer_site_group in ( 31010&amp;nbsp;) and beh=2&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;&lt;SPAN&gt;then CASite67= 3101 ; *Brain, Benign;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;&lt;SPAN&gt;if p&amp;nbsp;in ( 31010&amp;nbsp;) and beh=3&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;&lt;SPAN&gt;then CASite67= 3102 ; *Brain, Malignant;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; color: black;"&gt;Then I realized that brain tumor in the "&lt;SPAN&gt;Seer_site_group&lt;/SPAN&gt;" with code (32020) captures more than just C751-C753. &amp;nbsp;So the code should involve something like that:&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; color: black;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; color: black;"&gt;IF&lt;I&gt;&amp;nbsp;"beh" = 0 or 1; AND Primary_site = C751, C752, C753; AND histology_icdo3 NOT = 9050-9055, 9140, 9590-9992;&amp;nbsp; THEN = "Benign Brain"&lt;/I&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; color: black;"&gt;but I'm not sure how to integrate that&amp;nbsp;in one SAS doable statement along with the other cancer statements.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3" color="#000000"&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; color: black;"&gt;Thank you.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12475i831E6ACA1C01875F/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="brain.benign .JPG" title="brain.benign .JPG" /&gt;</description>
      <pubDate>Wed, 20 Apr 2016 20:37:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265225#M7309</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2016-04-20T20:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265229#M7310</link>
      <description>&lt;P&gt;Sorry I forgot that I had this statement too regarding the question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if Seer_site_group in ( 32020 )&lt;BR /&gt;then CASite67= 3400 ; *Other Endocrine including Thymus;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 20:49:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265229#M7310</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2016-04-20T20:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265246#M7311</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/47035"&gt;@mayasak﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Syntactically correct would be this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if beh in (0 1) and primary_site in ('C751' 'C752' 'C753') 
  and histology_icdo3 not in (9050:9055 9140 9590:9992) then CASite67 = 3101; *Brain, Benign;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(assuming that primary_site is a character variable with values such as those listed and histology_icdo3 is numeric, so that the abbreviations for ranges of integers like 1:5 for 1 2 3 4 5 are valid).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please adapt and combine this with a criterion about Seer_site_group if necessary and appropriate. It seems confusing to me that you write '&lt;SPAN&gt;brain tumor in the "&lt;/SPAN&gt;&lt;SPAN&gt;Seer_site_group&lt;/SPAN&gt;&lt;SPAN&gt;" with code (32020)'&lt;/SPAN&gt;&amp;nbsp;while code 32020 is rather subordinate to the endocrine system.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 21:49:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265246#M7311</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-04-20T21:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265250#M7312</link>
      <description>&lt;P&gt;If you have a condition that involves multiple comparisons then you may be looking at using the IN operator.&lt;/P&gt;
&lt;P&gt;Basically you provide the list of values inside paratheses:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If X in (23 24 25 26) then (do something)&lt;/P&gt;
&lt;P&gt;or for character comparisons:&lt;/P&gt;
&lt;P&gt;If y in ('23' '24' '25' '26') then ...&lt;/P&gt;
&lt;P&gt;You can use NOT as well&lt;/P&gt;
&lt;P&gt;If y not&amp;nbsp;in ('23' '24' '25' '26') then ...&lt;/P&gt;
&lt;P&gt;If you want a sequence of values that are &lt;STRONG&gt;numeric&lt;/STRONG&gt; (actual numbers not character values that look like numbers) you can use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if X in (3:6&amp;nbsp; 9 15) to match values of 3 to 6 and 9 and 15.&lt;/P&gt;
&lt;P&gt;So &lt;SPAN style="color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;IF&lt;I&gt;&amp;nbsp;"beh" = 0 or 1; AND Primary_site = C751, C752, C753"&lt;/I&gt;&lt;/SPAN&gt;&lt;I&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;SPAN style="color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;would become&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;SPAN style="color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;If beh in (0,1) and Primary_site in ('C751' 'C752' 'C753') ...&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;SPAN style="color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;I suspect you &lt;FONT face="Calibri"&gt;9050-9055, 9140, 9590-9992 values are likely to be character values and even writing an IN statement gets long and the range indicator : is not allowed for character comparisons.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;SPAN style="color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;FONT face="Calibri"&gt;You &lt;STRONG&gt;may&lt;/STRONG&gt; be able to use a custom format. Please look at the following code, run it and examine the log.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT face="Calibri"&gt;&lt;CODE class=" language-sas"&gt;proc format library=work;
value $code
'9050'-'9055', '9140', '9590'-'9992' = 'Match'
other ='No match';
run;

data _null_;
   length x $ 8.;
   do x= '9050','9051','9166','9593','95936','960';
      if put(x,$code.) = 'Match' then put "Found" x=;
   end;
run;&lt;/CODE&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT face="Calibri"&gt;Note that you test a character value. But character value ranges basically will accept anything that matches the first 4 characters if that is all that are used in the defining Format. So 95936 is considered to be between 9590 and 9992 because the 95936 part is. Also the 3 character string matches the first 3 that appear in that range.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;SPAN style="color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;FONT face="Calibri"&gt;So depending on your actual range of values of your histology variable (basically all of them exactly 4 characters) you may be able to include a condition of &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;SPAN style="color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;FONT face="Calibri"&gt;and put(histology_icd03,$code.)='No match' with the previous. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;SPAN style="color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;FONT face="Calibri"&gt;Or make a very long IN clause.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 21:58:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265250#M7312</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-20T21:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265428#M7314</link>
      <description>&lt;P&gt;Thank you &lt;SPAN class="login-bold"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733" target="_self"&gt;FreelanceReinhard&lt;/A&gt;, please n&lt;/SPAN&gt;ote that histology_icdo3 is a character value too with a length of exactly 4 for all&amp;nbsp;&lt;SPAN&gt;of them.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 14:18:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265428#M7314</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2016-04-21T14:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265438#M7315</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/47035"&gt;@mayasak&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thank you &lt;SPAN class="login-bold"&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;, please n&lt;/SPAN&gt;ote that histology_icdo3 is a character value too with a length of exactly 4 for all&amp;nbsp;&lt;SPAN&gt;of them.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This can be dealt with easily:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, if you know for sure that this character variable always ("always" in the relevant observations, not necessarily in general!) contains 4&amp;nbsp;digits (from '0' to '9'), you could replace the corresponding condition by&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;STRONG&gt;input(&lt;/STRONG&gt;histology_icdo3&lt;STRONG&gt;, 4.)&lt;/STRONG&gt; not in (9050:9055 9140 9590:9992)&lt;/PRE&gt;
&lt;P&gt;If, however, there is a possibility that some of the codes are alphanumeric and, e.g., '959A' is regarded as belonging to the range "9590-9992," you could use inequalities with regard to alphabetical order:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;not ('9050'&amp;lt;=histology_icdo3&amp;lt;='9055' | histology_icdo3='9140' | '9590'&amp;lt;=histology_icdo3&amp;lt;='9992')&lt;/PRE&gt;
&lt;P&gt;This is equivalent to ballardw's format approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 14:48:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265438#M7315</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-04-21T14:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265439#M7316</link>
      <description>&lt;P&gt;Thank you&amp;nbsp; &lt;SPAN class="login-bold"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884" target="_self"&gt;ballardw&lt;/A&gt;. The histology is a character variable&amp;nbsp;and it has exactly 4 characters&amp;nbsp;for all.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;I ran the&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;FONT face="Calibri"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;format&lt;/SPAN&gt; library&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;work&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;value&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;code &lt;SPAN class="token string"&gt;'9050'&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'9055'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'9140'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'9590'&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'9992'&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'Match'&lt;/SPAN&gt; other &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'No match'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; _null_&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;length&lt;/SPAN&gt; x &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;8&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; do x&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'9050'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'9051'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'9166'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'9593'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'95936'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'960'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;x&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;code&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'Match'&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"Found"&lt;/SPAN&gt; x&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; end&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;as it is after I read the data as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;libname temp "I:\cancer";&lt;/P&gt;&lt;P&gt;data CA_test;&lt;BR /&gt;set cancer_data;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then I added&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if Seer_site_group in (32020) and beh in (0,1) and Primary_site in ('C751' 'C752' 'C753') and (histology_icd03,$code.)='No match';&lt;BR /&gt;then CASite67= 3101 ; *Brain, Benign;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have the following error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if Seer_site_group in ( 32020 ) and beh in (0,1) and Primary_site in ('C751' 'C752' 'C753') and&lt;BR /&gt;2688! (histology_icd03 $code)='No match'&lt;BR /&gt;-&lt;BR /&gt;388&lt;BR /&gt;200&lt;BR /&gt;ERROR 388-185: Expecting an arithmetic operator.&lt;/P&gt;&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure what is done with the format statement and what has gone wrong. Do I have to run as it is or customize it somewhere according to my dataset. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 14:49:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265439#M7316</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2016-04-21T14:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265445#M7317</link>
      <description>&lt;P&gt;You forgot to type the name of the PUT function:&lt;/P&gt;
&lt;PRE&gt;&lt;STRONG&gt;put&lt;/STRONG&gt;(histology_icd03, $code.)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: ... among other things.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 15:52:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265445#M7317</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-04-21T15:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265449#M7318</link>
      <description>&lt;P&gt;I ran this as you've stated:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if Seer_site_group in ( 31010 32020 ) and beh in (0 1) and primary_site in ('C751' 'C752' 'C753') and input(histology_icdo3, 4.) not in (9050:9055 9140 9590:9992)&lt;BR /&gt;then CASite67= 3101 ; *Brain, Benign;&lt;BR /&gt;if Seer_site_group in ( 31010 ) and beh=3&lt;BR /&gt;then CASite67= 3102 ; *Brain, Malignant;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;there was no error in the log however, when I ran proc freq for casite67, &amp;nbsp;3101 was missing in the table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2900 97&lt;BR /&gt;3000 338&lt;BR /&gt;3102 1109&lt;BR /&gt;3200 2477&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also ran the proc freq with:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if Seer_site_group in ( 31010 32020 ) and beh in (0 1) and primary_site in ('C751' 'C752' 'C753')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;then CASite67= 3101 ; *Brain, Benign;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and had the same problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It worked only with:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if Seer_site_group in ( 31010 32020 ) and beh in (0 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;then CASite67= 3101 ; *Brain, Benign;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2900 97&lt;BR /&gt;3000 338&lt;BR /&gt;3101 285&lt;BR /&gt;3102 1109&lt;BR /&gt;3200 2477&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 15:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265449#M7318</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2016-04-21T15:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265455#M7319</link>
      <description>&lt;P&gt;Your error:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if Seer_site_group in ( 32020 ) and beh in (0,1) and Primary_site in ('C751' 'C752' 'C753') and
 (histology_icd03 $code)='No match'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Does not match the posted code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if Seer_site_group in (32020) and beh in (0,1) and Primary_site in ('C751' 'C752' 'C753') and (histology_icd03,$code.)='No match';
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Posted code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Missing Put(histology_ (etc.)) AND includes a ; before the then.&lt;/P&gt;
&lt;P&gt;The posted error is missing Put, comma separating variable and format, and period at end of format .&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 15:46:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265455#M7319</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-21T15:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265459#M7320</link>
      <description>&lt;P&gt;I rerun it with the correction. It went through with no errors but as I mentioned to &amp;nbsp;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733" target="_self"&gt;FreelanceReinhard&lt;/A&gt;&amp;nbsp;in my last reply that 3101 was missing when I ran the proc freq for casite67:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2900 &amp;nbsp; 97&lt;/P&gt;&lt;P&gt;3000 &amp;nbsp; 338&lt;/P&gt;&lt;P&gt;3102 &amp;nbsp; 1109&lt;/P&gt;&lt;P&gt;3200 &amp;nbsp; 2477&lt;/P&gt;&lt;P&gt;3300 &amp;nbsp; 4882&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked when only beh condition added.&lt;/P&gt;&lt;P&gt;Thank you a lot&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 16:04:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265459#M7320</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2016-04-21T16:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265462#M7321</link>
      <description>&lt;P&gt;We don't have your data. So, you'll have to check why the two IF conditions for casite67=3101 are never met. For example, you can apply the weak criterion that produces observations with&amp;nbsp;&lt;SPAN&gt;casite67=3101, let's call the resulting dataset RESULT, and then apply PROC FREQ to variables &lt;FONT face="courier new,courier"&gt;primary_site&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;histology_icdo3&lt;/FONT&gt;. Example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=result;
where casite67=3101;
format _all_;
tables primary_site;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Apr 2016 16:13:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265462#M7321</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-04-21T16:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265477#M7322</link>
      <description>&lt;P&gt;Freq results from:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;freq&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;result&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; casite67&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;3101&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;format&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;_all_&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;tables&lt;/SPAN&gt; beh primary_site &lt;SPAN&gt;histology_icdo3 /nocol nocum nopercent norow&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Beh Frequency&lt;/P&gt;&lt;P&gt;0 197&lt;BR /&gt;1 215&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;primary_site&lt;/P&gt;&lt;P&gt;primary_site Frequency&lt;/P&gt;&lt;P&gt;C710 &amp;nbsp;19&lt;BR /&gt;C711 &amp;nbsp;38&lt;BR /&gt;C712 &amp;nbsp;36&lt;BR /&gt;C713 &amp;nbsp;21&lt;BR /&gt;C714 &amp;nbsp;16&lt;BR /&gt;C715 &amp;nbsp;35&lt;BR /&gt;C716 &amp;nbsp;73&lt;BR /&gt;C717 &amp;nbsp;32&lt;BR /&gt;C718 9&lt;BR /&gt;C719 133&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;histology_icdo3&lt;/P&gt;&lt;P&gt;histology_icdo3 Frequency&lt;/P&gt;&lt;P&gt;8000 &amp;nbsp;132&lt;BR /&gt;8001 &amp;nbsp;1&lt;BR /&gt;8680 &amp;nbsp;1&lt;BR /&gt;8824 &amp;nbsp;1&lt;BR /&gt;8850 &amp;nbsp;2&lt;BR /&gt;9084 &amp;nbsp;3&lt;BR /&gt;9120 &amp;nbsp;31&lt;BR /&gt;9121 &amp;nbsp;42&lt;BR /&gt;9122 &amp;nbsp;1&lt;BR /&gt;9150 &amp;nbsp;4&lt;BR /&gt;9161 &amp;nbsp;53&lt;BR /&gt;9350 &amp;nbsp;4&lt;BR /&gt;9351 &amp;nbsp;4&lt;BR /&gt;9361 &amp;nbsp;1&lt;BR /&gt;9383 &amp;nbsp;20&lt;BR /&gt;9384 &amp;nbsp;3&lt;BR /&gt;9390 &amp;nbsp;18&lt;BR /&gt;9394 &amp;nbsp;3&lt;BR /&gt;9400 &amp;nbsp;2&lt;BR /&gt;9413 &amp;nbsp;4&lt;BR /&gt;9440 &amp;nbsp;2&lt;BR /&gt;9444 &amp;nbsp;2&lt;BR /&gt;9490 &amp;nbsp;1&lt;BR /&gt;9493 &amp;nbsp;2&lt;BR /&gt;9505 &amp;nbsp;23&lt;BR /&gt;9506 &amp;nbsp;4&lt;BR /&gt;9540 &amp;nbsp;5&lt;BR /&gt;9560 &amp;nbsp;43&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 17:17:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265477#M7322</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2016-04-21T17:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265478#M7323</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/47035"&gt;@mayasak&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;(...)&lt;BR /&gt;primary_site&lt;/P&gt;
&lt;P&gt;primary_site Frequency&lt;/P&gt;
&lt;P&gt;C710 &amp;nbsp;19&lt;BR /&gt;C711 &amp;nbsp;38&lt;BR /&gt;C712 &amp;nbsp;36&lt;BR /&gt;C713 &amp;nbsp;21&lt;BR /&gt;C714 &amp;nbsp;16&lt;BR /&gt;C715 &amp;nbsp;35&lt;BR /&gt;C716 &amp;nbsp;73&lt;BR /&gt;C717 &amp;nbsp;32&lt;BR /&gt;C718 9&lt;BR /&gt;C719 133&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;histology_icdo3&lt;/P&gt;
&lt;P&gt;(...)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;But you are no longer wondering why a criterion stronger than&lt;/P&gt;
&lt;PRE&gt;primary_site in ('C751' 'C752' 'C753')&lt;/PRE&gt;
&lt;P&gt;resulted in zero observations, are you?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 17:21:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265478#M7323</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-04-21T17:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional coding</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265493#M7324</link>
      <description>&lt;P&gt;Sure I'm not&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 18:14:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Conditional-coding/m-p/265493#M7324</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2016-04-21T18:14:34Z</dc:date>
    </item>
  </channel>
</rss>

