<?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: Matching observations based on ID number in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148231#M39197</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Seems you just have to sub-string out the id part, and then inner join on that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 01 Feb 2015 21:24:55 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2015-02-01T21:24:55Z</dc:date>
    <item>
      <title>Matching observations based on ID number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148230#M39196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a data set that contains cases and matched controls (most cases are matched 1:4 with controls). Each case-control group is identified by having the same ID number following with "X" for case and "A" "B" "C" "D" for controls. Example (GI001X GI001A GI001B GI001C). I would like to make a new dataset that only contains giardia cases and the matching controls. Is there a way to subset my data based on ID number? Basically I want to keep observations where "Giardia"=1 and "Case"=1 (this combination denotes giardia cases) as well as the matching controls in which "Case"=0. The tricky part is, not all the ID numbers are the same length- they range from 2-4 numbers followed the X or A,B,C,D. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2015 18:46:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148230#M39196</guid>
      <dc:creator>Mdormond</dc:creator>
      <dc:date>2015-02-01T18:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Matching observations based on ID number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148231#M39197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Seems you just have to sub-string out the id part, and then inner join on that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2015 21:24:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148231#M39197</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-02-01T21:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Matching observations based on ID number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148232#M39198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How would I go about doing that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2015 22:01:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148232#M39198</guid>
      <dc:creator>Mdormond</dc:creator>
      <dc:date>2015-02-01T22:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Matching observations based on ID number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148233#M39199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using substring and length functions. &lt;/P&gt;&lt;P&gt;I'm assuming Giardia and Case are different variables? &lt;/P&gt;&lt;P&gt;If you provide better sample data you get better answers, but not guarantees&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2015 22:10:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148233#M39199</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-01T22:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: Matching observations based on ID number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148234#M39200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your response, yes "Giardia" and "Case" are different variables. There are four main exposures of interest in my dataset (Giardia, Amebias, Cryptosporidium, and Cyclospora) in addition to the matched (1:4) controls for each. I would like to write a code to match all the case variables to corresponding controls and then make a dataset that only contains the Giardia cases and the matching controls. Is this more specific?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 15:16:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148234#M39200</guid>
      <dc:creator>Mdormond</dc:creator>
      <dc:date>2015-02-02T15:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Matching observations based on ID number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148235#M39201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I got it from the start. But the syntax for this is straightforward, and you should be able to find a solution by search the on-line documentation, papers, other forum threads, you name it...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 15:38:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148235#M39201</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-02-02T15:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: Matching observations based on ID number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148236#M39202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Post some test data and required output, maybe something like:&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;&amp;nbsp; group="GI001X"; output;&lt;BR /&gt;&amp;nbsp; group="GI001A"; output;&lt;BR /&gt;&amp;nbsp; group="GI001B"; output;&lt;BR /&gt;&amp;nbsp; group="AI001X"; output;&lt;BR /&gt;&amp;nbsp; group="AI001A"; output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data giarida amebias;&lt;BR /&gt;&amp;nbsp; set have;&lt;BR /&gt;&amp;nbsp; select(substr(group,1,3));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; when ("GI0") output giarida;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; when ("AI0") output amebias;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; otherwise;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 15:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148236#M39202</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-02-02T15:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Matching observations based on ID number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148237#M39203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great, I will do this tonight. Will the substring command correctly select even though some ID's are 3 characters long and some are 4?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 18:14:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148237#M39203</guid>
      <dc:creator>Mdormond</dc:creator>
      <dc:date>2015-02-02T18:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: Matching observations based on ID number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148238#M39204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to think of a string as an array of characters, e.g:&lt;/P&gt;&lt;P&gt;{1} {2} {3} {4} {5} {6}&lt;/P&gt;&lt;P&gt;G&amp;nbsp;&amp;nbsp; I&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; X&lt;/P&gt;&lt;P&gt;G&amp;nbsp;&amp;nbsp; I&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if we use substring(array 1 to array 3), both of these strings will be GI0 as 4-6 is dropped, hence they will match.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2015 09:16:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148238#M39204</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-02-03T09:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: Matching observations based on ID number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148239#M39205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can substring from the "end", see on-line doc for syntax.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2015 10:37:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148239#M39205</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-02-03T10:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Matching observations based on ID number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148240#M39206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've used the substring option as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;match_id= substr (ID, 3,5)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which gives me just the numeric portion of a variable as follows:&lt;/P&gt;&lt;P&gt;Match_ID:&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;101&lt;/P&gt;&lt;P&gt;101&lt;/P&gt;&lt;P&gt;101&lt;/P&gt;&lt;P&gt;102&lt;/P&gt;&lt;P&gt;102&lt;/P&gt;&lt;P&gt;102&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I need to run a descriptive analysis to get the characteristics of the cases and the matched controls. How do I run an analysis on controls matched to Giardia cases (the Giardia value for these observations will be 0). Can I make a new data set selecting only Giardia cases and the matched controls using the newly generated Match_ID variable? Something along the lines of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data New;&lt;/P&gt;&lt;P&gt;Set Old;&lt;/P&gt;&lt;P&gt;Where Giardia=1 and Match_ID=_____ ;(somehow denoting matched cases)&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 01:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148240#M39206</guid>
      <dc:creator>Mdormond</dc:creator>
      <dc:date>2015-02-04T01:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Matching observations based on ID number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148241#M39207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;II think I actually want to reword the data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Creat a variable "match id" which is the identification number without the trailing letter. I can't use the substring option with this because all the identification numbers are different lengths. I basically want to "drop" the last character in each ID. &lt;/P&gt;&lt;P&gt;2. create a dataset with only giardia cases abd the matched controls. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 22:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148241#M39207</guid>
      <dc:creator>Mdormond</dc:creator>
      <dc:date>2015-02-04T22:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Matching observations based on ID number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148242#M39208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. Substr(variable, 1, length(variable)-1);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 23:17:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148242#M39208</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-04T23:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Matching observations based on ID number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148243#M39209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great! How would I go about selecting cases and matched controls based on the two variables?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 23:47:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-observations-based-on-ID-number/m-p/148243#M39209</guid>
      <dc:creator>Mdormond</dc:creator>
      <dc:date>2015-02-04T23:47:35Z</dc:date>
    </item>
  </channel>
</rss>

