<?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: Recognizing random numbers from 1 til 3 billion. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Recognizing-random-numbers-from-1-til-3-billion/m-p/33710#M8158</link>
    <description>how about the simple thing first ;[pre]* just one series ;&lt;BR /&gt;
proc sort data= your.original out= sorted1 ;&lt;BR /&gt;
   by project_id ;&lt;BR /&gt;
run ;&lt;BR /&gt;
data series_1 ;&lt;BR /&gt;
 set sorted_1 ;&lt;BR /&gt;
 by project_id ;&lt;BR /&gt;
 key1 + first.project_id ;&lt;BR /&gt;
run ;[/pre]&lt;BR /&gt;
That pays no respect to the "14 large main programs (Z)", because you offer no way of detecting this from your description.&lt;BR /&gt;
If your "original" holds a variable Z which is the relevant "large main program" for each row, then my code could be revised like:[pre]* two series ;&lt;BR /&gt;
proc sort data= your.original out= sorted2 ;&lt;BR /&gt;
   by Z project_id ;&lt;BR /&gt;
run ;&lt;BR /&gt;
data series_2 ;&lt;BR /&gt;
 set sorted_2 ;&lt;BR /&gt;
 by Z project_id ;&lt;BR /&gt;
 if first.Z then do ;&lt;BR /&gt;
    key1 + 1 ;&lt;BR /&gt;
    sub_key = 0 ;&lt;BR /&gt;
 end ;&lt;BR /&gt;
 sub_key +first.project_id ;&lt;BR /&gt;
 length new_key $9 ;&lt;BR /&gt;
 new_key = cats( key1, ',', sub_key ) ;   &lt;BR /&gt;
 drop key1 sub_key ;&lt;BR /&gt;
run ;[/pre]Of course, without a proper set of test data, and therefore no proper understanding of your data model, this will probably not achieve what you needed.&lt;BR /&gt;
Would you like to provide some sample data (say 20 rows)?</description>
    <pubDate>Tue, 22 Dec 2009 14:49:50 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2009-12-22T14:49:50Z</dc:date>
    <item>
      <title>Recognizing random numbers from 1 til 3 billion.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Recognizing-random-numbers-from-1-til-3-billion/m-p/33709#M8157</link>
      <description>I have a dataset of approximately 5000 observations. &lt;BR /&gt;
&lt;BR /&gt;
Each observation is a firm, and each firm is part of a program. These programs have, over time, been inappropriately named values between 0 and 3 billion. All firms (in program X), have a project-id value of Y, but Y differs ALOT over the dataset. &lt;BR /&gt;
&lt;BR /&gt;
Some of the examples of the project-id variable are 55051, 5,42, 23341212 etcetera. &lt;BR /&gt;
&lt;BR /&gt;
So basically, what I’m looking to do, is for SAS to recognize (for example) the number 5,42 – and give a new variable a value of 1,01. The next step would be to find all the observations of 5,43, thus giving the new variable a values of 1,02, and so forth.&lt;BR /&gt;
&lt;BR /&gt;
However, there are quirks. All of these seeming random program-id values, all fit under 14 large main programs (Z). If possible, program Z would be fitted with the same initial values, for an example 1,xxx. &lt;BR /&gt;
&lt;BR /&gt;
Soooo. A quick resume, would be that I need SAS to run through numbers, from 1 to 3000000000, and every time SAS finds a unique value, call it something like n,(n-10)(n-1) for non-negative numbers. &lt;BR /&gt;
&lt;BR /&gt;
I’ve been struggling with this problem all day, and I’m absolutely out of ideas.&lt;BR /&gt;
I would appreciate any help that would point me in the right direction.&lt;BR /&gt;
&lt;BR /&gt;
Hope you can help.&lt;BR /&gt;
&lt;BR /&gt;
Kind regards&lt;BR /&gt;
Tobias</description>
      <pubDate>Tue, 22 Dec 2009 13:47:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Recognizing-random-numbers-from-1-til-3-billion/m-p/33709#M8157</guid>
      <dc:creator>Damvad</dc:creator>
      <dc:date>2009-12-22T13:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Recognizing random numbers from 1 til 3 billion.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Recognizing-random-numbers-from-1-til-3-billion/m-p/33710#M8158</link>
      <description>how about the simple thing first ;[pre]* just one series ;&lt;BR /&gt;
proc sort data= your.original out= sorted1 ;&lt;BR /&gt;
   by project_id ;&lt;BR /&gt;
run ;&lt;BR /&gt;
data series_1 ;&lt;BR /&gt;
 set sorted_1 ;&lt;BR /&gt;
 by project_id ;&lt;BR /&gt;
 key1 + first.project_id ;&lt;BR /&gt;
run ;[/pre]&lt;BR /&gt;
That pays no respect to the "14 large main programs (Z)", because you offer no way of detecting this from your description.&lt;BR /&gt;
If your "original" holds a variable Z which is the relevant "large main program" for each row, then my code could be revised like:[pre]* two series ;&lt;BR /&gt;
proc sort data= your.original out= sorted2 ;&lt;BR /&gt;
   by Z project_id ;&lt;BR /&gt;
run ;&lt;BR /&gt;
data series_2 ;&lt;BR /&gt;
 set sorted_2 ;&lt;BR /&gt;
 by Z project_id ;&lt;BR /&gt;
 if first.Z then do ;&lt;BR /&gt;
    key1 + 1 ;&lt;BR /&gt;
    sub_key = 0 ;&lt;BR /&gt;
 end ;&lt;BR /&gt;
 sub_key +first.project_id ;&lt;BR /&gt;
 length new_key $9 ;&lt;BR /&gt;
 new_key = cats( key1, ',', sub_key ) ;   &lt;BR /&gt;
 drop key1 sub_key ;&lt;BR /&gt;
run ;[/pre]Of course, without a proper set of test data, and therefore no proper understanding of your data model, this will probably not achieve what you needed.&lt;BR /&gt;
Would you like to provide some sample data (say 20 rows)?</description>
      <pubDate>Tue, 22 Dec 2009 14:49:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Recognizing-random-numbers-from-1-til-3-billion/m-p/33710#M8158</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-12-22T14:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: Recognizing random numbers from 1 til 3 billion.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Recognizing-random-numbers-from-1-til-3-billion/m-p/33711#M8159</link>
      <description>Hi Peter, thanks for the reply!&lt;BR /&gt;
&lt;BR /&gt;
The problem with detecting the 14 large maingroups, i have a solution for myself. It's no problem to identify the 14 programs and have a sheet for each of them.&lt;BR /&gt;
&lt;BR /&gt;
I can't figure out how to attach an excelfile?&lt;BR /&gt;
&lt;BR /&gt;
I've taken this ss of the data in an sheet. The data marked with green is the project-id, and the data marked with red are the firms involved.&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://dl.dropbox.com/u/1321324/Pics/test.JPG" target="_blank"&gt;http://dl.dropbox.com/u/1321324/Pics/test.JPG&lt;/A&gt;

Message was edited by: Damvad</description>
      <pubDate>Tue, 22 Dec 2009 15:18:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Recognizing-random-numbers-from-1-til-3-billion/m-p/33711#M8159</guid>
      <dc:creator>Damvad</dc:creator>
      <dc:date>2009-12-22T15:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Recognizing random numbers from 1 til 3 billion.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Recognizing-random-numbers-from-1-til-3-billion/m-p/33712#M8160</link>
      <description>Key1 counted up to 1864 different programs. I actually think, that i might know how to get on from here.&lt;BR /&gt;
&lt;BR /&gt;
I'll return with my solution, thanks alot for the help. That "key1 + first.projektid ;" is a usefull string of text &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
/T</description>
      <pubDate>Tue, 22 Dec 2009 15:27:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Recognizing-random-numbers-from-1-til-3-billion/m-p/33712#M8160</guid>
      <dc:creator>Damvad</dc:creator>
      <dc:date>2009-12-22T15:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Recognizing random numbers from 1 til 3 billion.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Recognizing-random-numbers-from-1-til-3-billion/m-p/33713#M8161</link>
      <description>OP reply: I can't figure out how to attach an excelfile?&lt;BR /&gt;
&lt;BR /&gt;
Attach it to an EMAIL or as a web-page hyperlink?&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments for each option mentioned:&lt;BR /&gt;
&lt;BR /&gt;
attach excel file email site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
generate hyperlink site:sas.com</description>
      <pubDate>Tue, 22 Dec 2009 15:37:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Recognizing-random-numbers-from-1-til-3-billion/m-p/33713#M8161</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-12-22T15:37:06Z</dc:date>
    </item>
  </channel>
</rss>

