<?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: K-FOLD CV &amp;amp; bootstrap in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/K-FOLD-CV-amp-bootstrap/m-p/454053#M283957</link>
    <description>Many thanks Reeza for your inputs. mY sas code work very well now. I did change the library name when I was sending my outputs</description>
    <pubDate>Fri, 13 Apr 2018 20:32:54 GMT</pubDate>
    <dc:creator>jeka1212</dc:creator>
    <dc:date>2018-04-13T20:32:54Z</dc:date>
    <item>
      <title>K-FOLD CV &amp; bootstrap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/K-FOLD-CV-amp-bootstrap/m-p/452643#M283955</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following SAS code and I want to clear datasets from previous runs of 10-forld CV and bootstrap.&amp;nbsp; I was wondering if you would be able to advise how to do it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also could you please advise how to add more resources in SAS? my SAS&amp;nbsp; do not work when when the number of replicates get to 200.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data kyphosis;
input y1 y2 d;
cards;
111	81	0
3	240	0
115	109	0
130	51	0
64	437	0
758	917	1
249	82	1
43	294	0
1493	101	1
5684	487	1
90	760	0
1499	147	1
229	254	0
474	305	1
88	4	0
3038	568	0
61	822	0
2134	1160	1
736	100	1
1195	136	1
5711	1037	1
10	111	0
271	271	0
1017	868	0
20	106	0
;
run;


%macro bootstrap (bootnum); *bootnum=12;

 *******************************************************************************
BOOTSTRAPPING
*******************************************************************************;

%do i = 1 %to &amp;amp;bootnum;

*supress log output if bootstrap samples become too large;
%if &amp;amp;bootnum &amp;gt; 10 %then %do;
	options nonotes nosource nosource2 errors=0;
%end;

*******************************************************************************
*clear datasets from previous runs;
*******************************************************************************;

   proc datasets library = work nodetails nolist;
    delete training&amp;amp;x.;
  run;
 
  proc datasets library = work nodetails nolist;
    delete temp&amp;amp;x.;
  run;


proc surveyselect data=kyphosis NOPRINT seed=1234
     out=kyphosis1a(rename=(Replicate=bootsample))
     method=urs              
     samprate=100  
     outhits            
     reps=&amp;amp;bootnum;       
run;

*******************************************************************************
K-FOLD CROSS VALIDATION
*******************************************************************************;

 data kyphosis1a;
    set kyphosis1a;
* if bootsample = &amp;amp;i;
      theRandom = ranuni(0);
   run;

proc rank data = kyphosis1a out=kRanked groups=10;
*by bootsample;
	var theRandom;
run;

%do x = 0 %to 9;
******************************************************************************
Create Training Data and Append in Libname out
*******************************************************************************;
dm log 'clear';

data training&amp;amp;x;
set kRanked;
where theRandom ne &amp;amp;x;
*by bootsample;
run;

******************************************************************************
Generate Binary variable beta1 for Biomarker 1 and Append in Libname out 1
*******************************************************************************;

proc sql;
create table temp&amp;amp;x as
select 
    a.y1 as compare_y1,
    b.*,
    a.y1 &amp;lt; b.y1 as beta
from training&amp;amp;x as a, training&amp;amp;x as b;
*order by compare_y1, y1;
quit;


%end; *end bootstrapping loop;

%end; *end 10-FOLD CROSS VALIDATIONloop;

%mend;
%bootstrap(10);

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Apr 2018 20:22:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/K-FOLD-CV-amp-bootstrap/m-p/452643#M283955</guid>
      <dc:creator>jeka1212</dc:creator>
      <dc:date>2018-04-09T20:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: K-FOLD CV &amp; bootstrap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/K-FOLD-CV-amp-bootstrap/m-p/452700#M283956</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I have the following SAS code and I want to clear datasets from previous runs of 10-forld CV and bootstrap.&amp;nbsp; I was wondering if you would be able to advise how to do it.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That's what PROC DATASETS in your code does. It deletes the data&amp;nbsp;sets indicated. If you want to delete more, add them to the DELETE statement. I typically like to use a naming convention, so that I can use the : colon short cut reference.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For&amp;nbsp;example if all your intermediary data sets start with CV_, you can drop all with:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=work nodetails nolist;
delete CV_:;
run; quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Note that PROC DATASETS requires a QUIT statement.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Also could you please advise how to add more resources in SAS? my SAS&amp;nbsp; do not work when when the number of replicates get to 200.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;What does 'not work' mean? Are you&amp;nbsp;getting an error of some kind, is it crashing or are the results not what you expect? Which step is generating the error?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can add the following options before your macro to see the full log.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options symbolgen mprint;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;And if your log is getting too full, then you'll want to use PROC PRINTTO to redirect it to a file so that you don't get the annoying popups about the log being full.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can reference this paper for more details on simulating and bootstrapping efficiently in SAS:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://www2.sas.com/proceedings/forum2007/183-2007.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2007/183-2007.pdf&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 01:05:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/K-FOLD-CV-amp-bootstrap/m-p/452700#M283956</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-10T01:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: K-FOLD CV &amp; bootstrap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/K-FOLD-CV-amp-bootstrap/m-p/454053#M283957</link>
      <description>Many thanks Reeza for your inputs. mY sas code work very well now. I did change the library name when I was sending my outputs</description>
      <pubDate>Fri, 13 Apr 2018 20:32:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/K-FOLD-CV-amp-bootstrap/m-p/454053#M283957</guid>
      <dc:creator>jeka1212</dc:creator>
      <dc:date>2018-04-13T20:32:54Z</dc:date>
    </item>
  </channel>
</rss>

