<?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: bootstrap in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/bootstrap/m-p/143099#M38064</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; I think you need to refresh yourself on some Macro basic concepts: &lt;A href="https://support.sas.com/resources/papers/proceedings13/120-2013.pdf" title="https://support.sas.com/resources/papers/proceedings13/120-2013.pdf"&gt;https://support.sas.com/resources/papers/proceedings13/120-2013.pdf&lt;/A&gt;&amp;nbsp; &lt;STRONG&gt;&amp;amp;numobs&lt;/STRONG&gt; is a macro variable and in your code, think of &lt;STRONG&gt;&amp;amp;numobs&lt;/STRONG&gt; as a placeholder. Every time the macro processor sees &lt;STRONG&gt;&amp;amp;numobs&lt;/STRONG&gt;, it will type 81 into your program (the current value of the macro variable). In the simplest form, the SAS macro processor is nothing more than a big "search and replace" typewriter. The &amp;amp; references that you see in your program are "resolved" at program compile time. By the time your program goes for execution with data, there are no &amp;amp; references or &lt;STRONG&gt;&amp;amp;macvar&lt;/STRONG&gt; references in your program. When I use the term &lt;STRONG&gt;"&amp;amp;macvar&lt;/STRONG&gt;", I am using a fake name to illustrate a macro variable being used as a placeholder in code. In your code, you have 2 macro variables: &lt;STRONG&gt;&amp;amp;numobs&lt;/STRONG&gt; and &lt;STRONG&gt;&amp;amp;numsamp&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;The %LET statement is only 1 way of assigning a value to the macro variable &lt;STRONG&gt;&amp;amp;numobs&lt;/STRONG&gt;, the SQL step by PGStats is another method. There are a few more. In order to code the %LET statement method, you must know ahead of time the number of observations you want to have used in the program, every time &lt;STRONG&gt;&amp;amp;numobs&lt;/STRONG&gt; is found. With PGStats method, you only need to know the name of the dataset whose number of obs you need. Essentially to use PGStats method, you would get rid of the %LET statement for&lt;STRONG&gt; &amp;amp;numobs&lt;/STRONG&gt; and replace it with the whole PROC SQL step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SAS Macro Facility is very cool and the general rule of thumb is that you start out with a working SAS program before you start to introduce macro variables into the code. But even cooler than macro variables is the ability to have macro programs that can conditionally generate code for you. Take a look at the paper. There are a lot of other good documents on using the SAS Macro facility and once you understand how it works, it will change the way you write SAS programs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 Jul 2014 13:13:51 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2014-07-31T13:13:51Z</dc:date>
    <item>
      <title>bootstrap</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/bootstrap/m-p/143094#M38059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Here is my program. As you can see I do a random sample with replacement. I need the sample to be of the same size as the original data. Here I know that the size is equal to 81, so I fixed it. But I want that my program count the number of obsevations automatically. I find that I can use the nbos but I do not know how?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let numsamp=1000;&lt;/P&gt;&lt;P&gt;%let numobs=81;&lt;/P&gt;&lt;P&gt;data temp04;&lt;/P&gt;&lt;P&gt;do bootsamp=1 to &amp;amp;numsamp;&lt;/P&gt;&lt;P&gt;do bootsamp_obsid=1 to &amp;amp;numobs;&lt;/P&gt;&lt;P&gt;random_seq_obsid=ceil(&amp;amp;numobs*ranuni(1));&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2014 19:53:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/bootstrap/m-p/143094#M38059</guid>
      <dc:creator>sasphd</dc:creator>
      <dc:date>2014-07-30T19:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: bootstrap</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/bootstrap/m-p/143095#M38060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can save yourself a lot of work with &lt;STRONG&gt;proc surveyselect&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc surveyselect data=myData out=want method=urs reps=1000 samprate=100 outhits ; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2014 20:37:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/bootstrap/m-p/143095#M38060</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-07-30T20:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: bootstrap</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/bootstrap/m-p/143096#M38061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Yes I know that. I tried it with proc surveyselect and it works with method=urs.&lt;/P&gt;&lt;P&gt;I Wants to do it this way to check something. &lt;/P&gt;&lt;P&gt;data base_orig;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set man.nv_bd_fonds_individuels10i;&lt;/P&gt;&lt;P&gt;&amp;nbsp; orig_seq_obsid + 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by crsp_fundno;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.crsp_fundno then orig_seq_obsid = 1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;* Generate 1000 bootstrap samples of random patient IDs;&lt;/P&gt;&lt;P&gt;%let numsamp=1000;&lt;/P&gt;&lt;P&gt;%let numobs=81;&lt;/P&gt;&lt;P&gt;data temp04;&lt;/P&gt;&lt;P&gt;do bootsamp=1 to &amp;amp;numsamp;&lt;/P&gt;&lt;P&gt;do bootsamp_obsid=1 to &amp;amp;numobs;&lt;/P&gt;&lt;P&gt;random_seq_obsid=ceil(&amp;amp;numobs*ranuni(1));&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2014 20:43:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/bootstrap/m-p/143096#M38061</guid>
      <dc:creator>sasphd</dc:creator>
      <dc:date>2014-07-30T20:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: bootstrap</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/bootstrap/m-p/143097#M38062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You want the total number of observations in your dataset into a macro variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql noprint;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select count(*) into :numobs from man.nv_bd_fonds_individuels10i;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2014 21:23:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/bootstrap/m-p/143097#M38062</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-07-30T21:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: bootstrap</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/bootstrap/m-p/143098#M38063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please tell me how can I include this in my bootstrap. In place of having &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;numobs=81&lt;/SPAN&gt; (constant), I will make my program count the number of observations for each id and generate 1000 bootstrap samples for each id.&lt;/P&gt;&lt;P&gt;In the example, I suppose that I have id=1 and I find 81 observations. So, by doing the bootstrap I will have totaly 81000 because &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; I need the sample to be of the same size as the original data&lt;/SPAN&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2014 12:28:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/bootstrap/m-p/143098#M38063</guid>
      <dc:creator>sasphd</dc:creator>
      <dc:date>2014-07-31T12:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: bootstrap</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/bootstrap/m-p/143099#M38064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; I think you need to refresh yourself on some Macro basic concepts: &lt;A href="https://support.sas.com/resources/papers/proceedings13/120-2013.pdf" title="https://support.sas.com/resources/papers/proceedings13/120-2013.pdf"&gt;https://support.sas.com/resources/papers/proceedings13/120-2013.pdf&lt;/A&gt;&amp;nbsp; &lt;STRONG&gt;&amp;amp;numobs&lt;/STRONG&gt; is a macro variable and in your code, think of &lt;STRONG&gt;&amp;amp;numobs&lt;/STRONG&gt; as a placeholder. Every time the macro processor sees &lt;STRONG&gt;&amp;amp;numobs&lt;/STRONG&gt;, it will type 81 into your program (the current value of the macro variable). In the simplest form, the SAS macro processor is nothing more than a big "search and replace" typewriter. The &amp;amp; references that you see in your program are "resolved" at program compile time. By the time your program goes for execution with data, there are no &amp;amp; references or &lt;STRONG&gt;&amp;amp;macvar&lt;/STRONG&gt; references in your program. When I use the term &lt;STRONG&gt;"&amp;amp;macvar&lt;/STRONG&gt;", I am using a fake name to illustrate a macro variable being used as a placeholder in code. In your code, you have 2 macro variables: &lt;STRONG&gt;&amp;amp;numobs&lt;/STRONG&gt; and &lt;STRONG&gt;&amp;amp;numsamp&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;The %LET statement is only 1 way of assigning a value to the macro variable &lt;STRONG&gt;&amp;amp;numobs&lt;/STRONG&gt;, the SQL step by PGStats is another method. There are a few more. In order to code the %LET statement method, you must know ahead of time the number of observations you want to have used in the program, every time &lt;STRONG&gt;&amp;amp;numobs&lt;/STRONG&gt; is found. With PGStats method, you only need to know the name of the dataset whose number of obs you need. Essentially to use PGStats method, you would get rid of the %LET statement for&lt;STRONG&gt; &amp;amp;numobs&lt;/STRONG&gt; and replace it with the whole PROC SQL step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SAS Macro Facility is very cool and the general rule of thumb is that you start out with a working SAS program before you start to introduce macro variables into the code. But even cooler than macro variables is the ability to have macro programs that can conditionally generate code for you. Take a look at the paper. There are a lot of other good documents on using the SAS Macro facility and once you understand how it works, it will change the way you write SAS programs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2014 13:13:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/bootstrap/m-p/143099#M38064</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2014-07-31T13:13:51Z</dc:date>
    </item>
  </channel>
</rss>

