<?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 Saving Unique ID's from a Bootstrap sample in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Saving-Unique-ID-s-from-a-Bootstrap-sample/m-p/247106#M13025</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset of subjects and their covariates, over time (for each subject I have multiple rows representing multiple time points). I wish to perform a bootstraping with replacement, i.e., if my current N is 20 subjects, I wish to create a file of 100 subjects, while keeping all their characteristics. This data will then be used in some model. Since modelling is the purpose, I need to get a column of &lt;STRONG&gt;unique ID's&lt;/STRONG&gt;. Example: If subject #1 is chosen 3 times (and I have 5 time points), then I will have 15 rows with ID = 1, while I need 3 times 5 rows with uniqe ID's, such as 1a, 1b and 1c (of course the coding is not important to me, it can be anything).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc surveyselect data = original_data method = urs sampsize = 100 rep = 1 seed = 12345 out = Sample_WR;
id _all_;
samplingunit ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I tried looking at the help of the procedure but didn't find it. How do I keep &lt;STRONG&gt;unique ID's&lt;/STRONG&gt; of my samples, rather than my subject ID's ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I basically need is a column counting the samples: sample1, sample2, ....sample100.&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>Sun, 31 Jan 2016 13:15:41 GMT</pubDate>
    <dc:creator>BlueNose</dc:creator>
    <dc:date>2016-01-31T13:15:41Z</dc:date>
    <item>
      <title>Saving Unique ID's from a Bootstrap sample</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Saving-Unique-ID-s-from-a-Bootstrap-sample/m-p/247106#M13025</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset of subjects and their covariates, over time (for each subject I have multiple rows representing multiple time points). I wish to perform a bootstraping with replacement, i.e., if my current N is 20 subjects, I wish to create a file of 100 subjects, while keeping all their characteristics. This data will then be used in some model. Since modelling is the purpose, I need to get a column of &lt;STRONG&gt;unique ID's&lt;/STRONG&gt;. Example: If subject #1 is chosen 3 times (and I have 5 time points), then I will have 15 rows with ID = 1, while I need 3 times 5 rows with uniqe ID's, such as 1a, 1b and 1c (of course the coding is not important to me, it can be anything).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc surveyselect data = original_data method = urs sampsize = 100 rep = 1 seed = 12345 out = Sample_WR;
id _all_;
samplingunit ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I tried looking at the help of the procedure but didn't find it. How do I keep &lt;STRONG&gt;unique ID's&lt;/STRONG&gt; of my samples, rather than my subject ID's ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I basically need is a column counting the samples: sample1, sample2, ....sample100.&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>Sun, 31 Jan 2016 13:15:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Saving-Unique-ID-s-from-a-Bootstrap-sample/m-p/247106#M13025</guid>
      <dc:creator>BlueNose</dc:creator>
      <dc:date>2016-01-31T13:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Saving Unique ID's from a Bootstrap sample</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Saving-Unique-ID-s-from-a-Bootstrap-sample/m-p/247108#M13026</link>
      <description>&lt;P&gt;I think I may undstand what you want and as far as I can tell you will need to create the variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc surveyselect data = sashelp.shoes method=urs sampsize=50 rep=1 seed=12345 out=Sample_WR;
   id _all_;
   samplingunit region Subsidiary;
   run;
data sample_wr;
   set sample_wr;
   do sampleUnitID=1 to numberhits;
      output;
      end;
   run;
proc sort data=sample_wr;
   by Replicate region Subsidiary sampleUnitID;
   run;
data sample_wr;
   set sample_wr;
   by Replicate region Subsidiary sampleunitid;
   if first.Replicate then sampleID = 0;
   if first.sampleunitid then sampleID + 1;
   run;
proc print;
   where numberhits gt 1;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1691iED46509AAA4D7BE2/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 31 Jan 2016 13:51:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Saving-Unique-ID-s-from-a-Bootstrap-sample/m-p/247108#M13026</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-01-31T13:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: Saving Unique ID's from a Bootstrap sample</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Saving-Unique-ID-s-from-a-Bootstrap-sample/m-p/247140#M13029</link>
      <description>&lt;P&gt;Here is a straitforward approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* example data */ 
data test;
call streaminit(12345);
do id = 1 to 5;
    do t = 1 to rand("Poisson", 4);
        x = rand("NORMAL");
        output;
        end;
    end;
drop t;
run;

/* Add variable n = cluster size */
proc sql;
create table test0 as
select *, count(*) as n  
from test
group by id;
quit;

/* Select sample with replacement */
proc surveyselect data=test0 out=sample0 method=urs sampsize=10 outhits seed=54321;
cluster id;
id n x;
run;

/* Generate new IDs */
data sample;
set sample0; by id;
if first.id then i = 0;
i + 1;
newId + mod(i, n) = 1;
drop i id n numberHits;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 31 Jan 2016 23:05:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Saving-Unique-ID-s-from-a-Bootstrap-sample/m-p/247140#M13029</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-01-31T23:05:34Z</dc:date>
    </item>
  </channel>
</rss>

