<?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: Miscoding mystery in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172921#M33217</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may want to invest time in some custom formats if you do a lot of this type of coding. Once you have the formats or informats created you can do a lot with things, sometimes without even creating new variables, for grouping variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance I have codes that use clinic level identifiers to create regions or agency information. And if one of the clinics changes I only have to change that in the format and the new behavior is available at the next report time without changing the report code. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Feb 2015 23:45:23 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-02-17T23:45:23Z</dc:date>
    <item>
      <title>Miscoding mystery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172913#M33209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings.&lt;/P&gt;&lt;P&gt;I have dissected and re-written this code in with checks for hours, and am completely stuck as to why the errors are occurring. This code involves taking combinations of cancer histology and primary site codes and mapping them to specific cancer diagnosis types:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data lymphoma2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge lymphoma1 (in=in1 keep=sitecd histocd)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map (keep=histocd diagcd);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by histocd;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if in1; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if 700&amp;lt;=sitecd&amp;lt;=729 then diagcd=38;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the above code, the merge takes the diagnosis codes (diagcd) from dataset "map" and maps them to the histology codes (histcd) in the cancer records from the dataset "lymphoma1". The if statement then takes records with site codes (sitecd) between 700 and 729 and hard codes them specifically to diagcd=38, instead of using the diagcd in the "map" dataset. However, after this data step, there are records where diagcd=38 but not the correct sitecd combination (ie, records with sitecd=770 were also mapped to diagcd=38). What is strange is if I had created a new variable, I wouldn't have the same problem:&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;data lymphoma2;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge lymphoma1 (in=in1 keep=sitecd histocd)&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map (keep=histocd diagcd);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by histocd;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if in1; &lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newcd=diagcd;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if 700&amp;lt;=sitecd&amp;lt;=729 then newcd=38;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;run;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;I would really appreciate any insight as to why this error occurs. Thank you in advance for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 20:29:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172913#M33209</guid>
      <dc:creator>LPark</dc:creator>
      <dc:date>2015-02-17T20:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Miscoding mystery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172914#M33210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't understand the question. Here is sample data that I think represents your "problem".&lt;/P&gt;&lt;P&gt;What value do you want for DIAGCD for the first observation if not the value from MAP?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data lymphoma1 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;input histocd sitecd ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;2 770&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data map ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; input histocd diagcd ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;2 38&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data lymphoma2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge lymphoma1 (in=in1 keep=sitecd histocd)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map (keep=histocd diagcd);&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by histocd;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if in1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if 700&amp;lt;=sitecd&amp;lt;=729 then diagcd=38;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;put (_all_) (=);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;histocd=1 sitecd=700 diagcd=38&lt;/P&gt;&lt;P&gt;histocd=2 sitecd=770 diagcd=38&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 20:45:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172914#M33210</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-02-17T20:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: Miscoding mystery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172915#M33211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Tom,&lt;/P&gt;&lt;P&gt;Thank you for responding to my plea for help. Let's change up the example:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;data lymphoma1 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;input histocd sitecd ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;1 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;2 770&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;data map ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&amp;nbsp; input histocd diagcd ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;1 10&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;2 11&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Then based on my code, I would expect the final result:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;histocd=1 sitecd=700 diagcd=38 (this is the result of the hard code since sitecd=700)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;histocd=2 sitecd=770 diagcd=11 (this comes straight from the map)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;but when I run the code with the datasets I attached earlier, diagcd for records with sitecd outside the 700-729 range get changed to 38.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Please let me know if I can clarify further. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 21:01:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172915#M33211</guid>
      <dc:creator>LPark</dc:creator>
      <dc:date>2015-02-17T21:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Miscoding mystery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172916#M33212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would I be correct to guess that this is a one-to-many merge?&amp;nbsp; That is, map is unique by histocd but lymphoma1 is not?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you merge datasets using a BY statement, variables read from a data set are implicitly retained.&amp;nbsp; The PDV is initialized when the BY group changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a one to many merge, if you reassign a value in the "one" dataset, that value will be retained until the by-group changes.&amp;nbsp; When I took a SAS training course, they had us work through the merge process and program data vector with paper, to understand this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's an example of your problem:&lt;/P&gt;&lt;PRE&gt;data many;
input id test score;
cards;
1 1 10
1 2 15
1 3 20
2 1 10
2 2 15
2 3 20
;

data one;
input id gender $1;
cards;
1 M
2 F
;
run;

71&amp;nbsp;&amp;nbsp; data want;
72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge many (keep=id test score)
73&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; one&amp;nbsp; (keep=id gender)
74&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;
75&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id;
76&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if test=2 then gender='X';
77&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put (_all_)(=);
78&amp;nbsp;&amp;nbsp; run;

id=1 test=1 score=10 gender=1
id=1 test=2 score=15 gender=X
id=1 test=3 score=20 gender=X
id=2 test=1 score=10 gender=2
id=2 test=2 score=15 gender=X
id=2 test=3 score=20 gender=X
NOTE: There were 6 observations read from the data set WORK.MANY.
NOTE: There were 2 observations read from the data set WORK.ONE.
NOTE: The data set WORK.WANT has 6 observations and 4 variables.

&lt;/PRE&gt;&lt;P&gt;When you create a new variable, that variable is NOT retained, so everything works as you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A "rule" might be to avoid changing the values of any variables when you merge data in a one-to-many merge.&amp;nbsp; Another sign that you may be headed for trouble is when something just feels odd.&amp;nbsp; In my above example, why would I recode a patient-attribute (gender), based on a test-level (test) attribute?&amp;nbsp; In your example, why recode diagnostic code based on site id?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 21:03:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172916#M33212</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2015-02-17T21:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Miscoding mystery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172917#M33213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The merging seems to work fine - I checked the individual records before and after. I also verified the results with and without the "if" statement. To address your question - there are specific histology codes that are associated with non-Hodgkin lymphoma and leukemia. The "map" dataset, therefore, provides the correct diagnosis code to each of the histology codes from the "lymphoma" dataset. However, if a record with a non-Hodgkin lymphoma histology occurs at a site related to the brain or nervous system (700&amp;lt;=sitecd&amp;lt;=729), we want those records coded specifically to "central nervous system lymphoma" (diagcd 38). This is what the if statement is trying to accomplish, but for some reason, it's also mapping diagcd 38 to other sites. I attached datasets in my original posting, which I hope will illustrate the problem. If you run:&lt;/P&gt;&lt;P&gt;proc freq data=lymphoma2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tables diagcd*sitecd/list;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;you'll see that there are sitecd&amp;gt;729 that were mapped to diagcd=38. Without the "if" statement in the data step, those records would have been mapped to diagcd=37 or 39.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 21:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172917#M33213</guid>
      <dc:creator>LPark</dc:creator>
      <dc:date>2015-02-17T21:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Miscoding mystery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172918#M33214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think that Quentin already explain why you aren't getting what you expect. The following is one way to control the behavior that he described:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;data lymphoma2 (drop=_diagcd);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge lymphoma1 (in=in1 keep=sitecd histocd)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map (keep=histocd diagcd rename=(diagcd=_diagcd));&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by histocd;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if in1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if 700&amp;lt;=sitecd&amp;lt;=729 then diagcd=38;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else diagcd=_diagcd;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 22:56:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172918#M33214</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-02-17T22:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Miscoding mystery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172919#M33215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, all! I understand now - this has been very helpful. And I will be sure to create new variables for this purpose in the future.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 22:59:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172919#M33215</guid>
      <dc:creator>LPark</dc:creator>
      <dc:date>2015-02-17T22:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Miscoding mystery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172920#M33216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you reset the value of the IN= variable at the top of the data step loop you can see when new records are actually read from the dataset.&lt;/P&gt;&lt;P&gt;This will explain why value for DIAGCD are carried forward onto other observations for the same HISTOCD group.&amp;nbsp; A new record is NOT read from the MAP dataset to get back to the old value of DIAGCD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data lymphoma ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;input histocd sitecd ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1 600&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1 700&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1 770&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data map ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; input histocd diagcd ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1 11&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;libname a 'c:\downloads';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data lymphoma2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;in1=0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;in2=0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge lymphoma (in=in1 keep=sitecd histocd)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map (in=in2 keep=histocd diagcd);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by histocd;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if first.histocd then n=0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;n+1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;put (in1 in2 n histocd sitecd diagcd ) (=) '-&amp;gt; ' @;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if 700&amp;lt;=sitecd&amp;lt;=729 then diagcd=38;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;put diagcd= ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;in1=1 in2=1 n=1 histocd=1 sitecd=600 diagcd=11 -&amp;gt; diagcd=11&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;in1=1 in2=0 n=2 histocd=1 sitecd=700 diagcd=11 -&amp;gt; diagcd=38&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;in1=1 in2=0 n=3 histocd=1 sitecd=770 diagcd=38 -&amp;gt; diagcd=38&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 23:37:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172920#M33216</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-02-17T23:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Miscoding mystery</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172921#M33217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may want to invest time in some custom formats if you do a lot of this type of coding. Once you have the formats or informats created you can do a lot with things, sometimes without even creating new variables, for grouping variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance I have codes that use clinic level identifiers to create regions or agency information. And if one of the clinics changes I only have to change that in the format and the new behavior is available at the next report time without changing the report code. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 23:45:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Miscoding-mystery/m-p/172921#M33217</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-02-17T23:45:23Z</dc:date>
    </item>
  </channel>
</rss>

