<?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 Creating a new variable in one dataset from information from a second dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-in-one-dataset-from-information-from-a/m-p/111585#M259026</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am a new user of SAS, and the learning curve is steep but Im getting there slowly.&lt;/P&gt;&lt;P&gt;I was hoping someone could help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I have is two data sets.&lt;/P&gt;&lt;P&gt;The first data set (work.road) has information about sections of road, these sections are defined by 4 varibales; the road name (road_no) the carriage way type, whether it be left, right or single (cway) and a start and finish point (slk_start and slk_end).&lt;/P&gt;&lt;P&gt;The second data set (work.crashes) has information about the location and nature of crashes, where each row is a different crash. The location information about each crash includes road_no, cway and a specific point along the road (slk).&lt;/P&gt;&lt;P&gt;What I wish to do is create a new variable in work.road that represents the number of crashes along each section of road (or observation/row).&lt;/P&gt;&lt;P&gt;So my question can be worded something along the lines of: How many observations in work.crashes have the same road_no and cway and where SLK_start le SLK le SLK_end for each observation/row in work.road?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have done alot of reading in the SAS help pages and resources and have found things including hash and hiter that seem promising, however, as I am only a new user I don't fully understand how they work and are therefore having problems trying to impose my additional limitations and criteria on the more simple examples.&lt;/P&gt;&lt;P&gt;Am I on the right track?&lt;/P&gt;&lt;P&gt;Can someone help me write some code to perform this type of merging?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Fritha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Apr 2013 02:29:11 GMT</pubDate>
    <dc:creator>FrithaArgus</dc:creator>
    <dc:date>2013-04-18T02:29:11Z</dc:date>
    <item>
      <title>Creating a new variable in one dataset from information from a second dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-in-one-dataset-from-information-from-a/m-p/111585#M259026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am a new user of SAS, and the learning curve is steep but Im getting there slowly.&lt;/P&gt;&lt;P&gt;I was hoping someone could help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I have is two data sets.&lt;/P&gt;&lt;P&gt;The first data set (work.road) has information about sections of road, these sections are defined by 4 varibales; the road name (road_no) the carriage way type, whether it be left, right or single (cway) and a start and finish point (slk_start and slk_end).&lt;/P&gt;&lt;P&gt;The second data set (work.crashes) has information about the location and nature of crashes, where each row is a different crash. The location information about each crash includes road_no, cway and a specific point along the road (slk).&lt;/P&gt;&lt;P&gt;What I wish to do is create a new variable in work.road that represents the number of crashes along each section of road (or observation/row).&lt;/P&gt;&lt;P&gt;So my question can be worded something along the lines of: How many observations in work.crashes have the same road_no and cway and where SLK_start le SLK le SLK_end for each observation/row in work.road?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have done alot of reading in the SAS help pages and resources and have found things including hash and hiter that seem promising, however, as I am only a new user I don't fully understand how they work and are therefore having problems trying to impose my additional limitations and criteria on the more simple examples.&lt;/P&gt;&lt;P&gt;Am I on the right track?&lt;/P&gt;&lt;P&gt;Can someone help me write some code to perform this type of merging?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Fritha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2013 02:29:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-in-one-dataset-from-information-from-a/m-p/111585#M259026</guid>
      <dc:creator>FrithaArgus</dc:creator>
      <dc:date>2013-04-18T02:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable in one dataset from information from a second dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-in-one-dataset-from-information-from-a/m-p/111586#M259027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Leave hash techniques aside for the time being until you are more advanced.&lt;/P&gt;&lt;P&gt;This question can be readily answered using Proc SQL with a left join and a count function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2013 03:31:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-in-one-dataset-from-information-from-a/m-p/111586#M259027</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2013-04-18T03:31:52Z</dc:date>
    </item>
  </channel>
</rss>

