<?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: Question: Changing number of observations (Macro in bootstrapping/resampling) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/433350#M107419</link>
    <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &amp;amp;lib = SASHELP and &amp;amp;data = CLASS %then %do;
   %let dsid   = %sysfunc(open(&amp;amp;lib..&amp;amp;data));
   %let numobs = %sysfunc(attrn(&amp;amp;dsid,nobs));
   %let rc     = %sysfunc(close(&amp;amp;dsid     ));
%end;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 02 Feb 2018 02:14:12 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-02-02T02:14:12Z</dc:date>
    <item>
      <title>Question: Changing number of observations (Macro in bootstrapping/resampling)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/433338#M107415</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a time-series of residuals (along with company, date) obtained from the "Reg" procedure, I would like to resample the residual series by the company (each has different number of observations), and make the sample size of each company equal to the number of observations that company has.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use the following example. My question is how do I&amp;nbsp;change that "19" in number of observations into something that changes based on each company.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &amp;amp;lib = sashelp and &amp;amp;data = class %then %let numobs = 19;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any suggestion would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 01:10:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/433338#M107415</guid>
      <dc:creator>KrisDeng</dc:creator>
      <dc:date>2018-02-02T01:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Question: Changing number of observations (Macro in bootstrapping/resampling)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/433350#M107419</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &amp;amp;lib = SASHELP and &amp;amp;data = CLASS %then %do;
   %let dsid   = %sysfunc(open(&amp;amp;lib..&amp;amp;data));
   %let numobs = %sysfunc(attrn(&amp;amp;dsid,nobs));
   %let rc     = %sysfunc(close(&amp;amp;dsid     ));
%end;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 02:14:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/433350#M107419</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-02-02T02:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Question: Changing number of observations (Macro in bootstrapping/resampling)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/434034#M107684</link>
      <description>Thank you very much for your reply. Since I still having a hard time applying your codes to mine, I'd really appreciate it if you could kindly elaborate the logic behind the use of sysfunc.</description>
      <pubDate>Mon, 05 Feb 2018 02:03:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/434034#M107684</guid>
      <dc:creator>KrisDeng</dc:creator>
      <dc:date>2018-02-05T02:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Question: Changing number of observations (Macro in bootstrapping/resampling)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/434035#M107685</link>
      <description>&lt;P&gt;Sysfunc simply allows to use SAS functions inside the macro language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is full working code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro t;
  %local lib data dsid numobs rc;
  %let lib= SASHELP;
  %let data = CLASS;
  %if &amp;amp;lib = SASHELP and &amp;amp;data = CLASS %then %do;
     %let dsid   = %sysfunc(open(&amp;amp;lib..&amp;amp;data));
     %let numobs = %sysfunc(attrn(&amp;amp;dsid,nobs));
     %let rc     = %sysfunc(close(&amp;amp;dsid     ));
  %end;
  %put &amp;amp;=numobs;
%mend;
%t
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;NUMOBS=19&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;So here we open a table, extract NOBS from its metadata and close the table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 02:39:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/434035#M107685</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-02-05T02:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Question: Changing number of observations (Macro in bootstrapping/resampling)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/434036#M107686</link>
      <description>Thank you very much. This is much clearer to me now.</description>
      <pubDate>Mon, 05 Feb 2018 02:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/434036#M107686</guid>
      <dc:creator>KrisDeng</dc:creator>
      <dc:date>2018-02-05T02:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Question: Changing number of observations (Macro in bootstrapping/resampling)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/434235#M107751</link>
      <description>Hi Chris,&lt;BR /&gt;&lt;BR /&gt;The codes worked perfectly. I wonder if this &amp;amp;numobs can be changing for each group, reflecting its separate number of observation?&lt;BR /&gt;&lt;BR /&gt;Thank you very much.</description>
      <pubDate>Mon, 05 Feb 2018 16:20:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/434235#M107751</guid>
      <dc:creator>KrisDeng</dc:creator>
      <dc:date>2018-02-05T16:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Question: Changing number of observations (Macro in bootstrapping/resampling)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/434703#M107910</link>
      <description>&lt;P&gt;Unsure what you are asking, Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro t;
  %local lib data dsid numobs rc;
  %let lib= SASHELP;
  %let data = CLASS;
  %if &amp;amp;lib = SASHELP and &amp;amp;data = CLASS %then %do;
     %let dsid   = %sysfunc(open(&amp;amp;lib..&amp;amp;data(where=(AGE=12))));
     %let numobs = %sysfunc(attrn(&amp;amp;dsid,nlobsf));
     %let rc     = %sysfunc(close(&amp;amp;dsid       ));
  %end;
  %put &amp;amp;=numobs;
%mend;
%t&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;NUMOBS=5&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 21:37:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/434703#M107910</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-02-06T21:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Question: Changing number of observations (Macro in bootstrapping/resampling)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/434933#M107988</link>
      <description>Exactly. Thank you very much!</description>
      <pubDate>Wed, 07 Feb 2018 16:16:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-Changing-number-of-observations-Macro-in-bootstrapping/m-p/434933#M107988</guid>
      <dc:creator>KrisDeng</dc:creator>
      <dc:date>2018-02-07T16:16:12Z</dc:date>
    </item>
  </channel>
</rss>

