<?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: Replicate number in PROC SURVEYSELECT in a macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replicate-number-in-PROC-SURVEYSELECT-in-a-macro/m-p/452790#M114313</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;What if you replace&lt;/P&gt;&lt;PRE&gt;rep =(&amp;amp;i*&amp;amp;rep)+&amp;amp;rep&lt;/PRE&gt;&lt;P&gt;with&lt;/P&gt;&lt;PRE&gt;reps =%eval((&amp;amp;i*&amp;amp;rep)+&amp;amp;rep)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;... assuming that &amp;amp;rep is initialized somewhere ?&lt;/P&gt;</description>
    <pubDate>Tue, 10 Apr 2018 13:15:45 GMT</pubDate>
    <dc:creator>FloT</dc:creator>
    <dc:date>2018-04-10T13:15:45Z</dc:date>
    <item>
      <title>Replicate number in PROC SURVEYSELECT in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replicate-number-in-PROC-SURVEYSELECT-in-a-macro/m-p/452757#M114296</link>
      <description>&lt;P&gt;Dear SAS users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am generating samples using SURVEYSELECT and then running PROC GLM with a BY command, all of this in a&amp;nbsp;MACRO to save the results in indivudal files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the repetition variable, which goes from 1... n in each iteration to&amp;nbsp;start where the other iteration left off.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So:&lt;/P&gt;&lt;P&gt;if i=1 then&amp;nbsp; rep=1, ...,5&lt;/P&gt;&lt;P&gt;if i=2 then&amp;nbsp; rep=6,...10&lt;/P&gt;&lt;P&gt;if i=3 then rep=11...15&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would make the REP option in my code equal to REP=(&amp;amp;i*&amp;amp;rep)+&amp;amp;rep which would give me this result, but that doesn't seem to be recognized as a symbol.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on how to achieve the same result?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro do_survey;
options mprint symbolgen;
%do i=0 %to 2;

proc surveyselect data=claims out=bootsample
     seed = 1347 method = urs
	 samprate = 1 outhits rep =(&amp;amp;i*&amp;amp;rep)+&amp;amp;rep;
run;

ods listing close;

proc glm data=Bootsample;
class year(ref='2010' ) age_gr (ref='0' );
model indavgcost= year|avgcontract/ solution;
TITLE "ALL HOSPITALS-indavgcost";
by replicate;
ods output ParameterEstimates=work.t_&amp;amp;i;
run;

data t_&amp;amp;i;
set t_&amp;amp;i;
keep replicate parameter estimate;
run;

data t_&amp;amp;i;
set t_&amp;amp;i;
if estimate=0 then delete;
run;

proc datasets;
append base=t1 data=t_&amp;amp;i force;
run;
quit;

%end;
%mend do_survey;

%do_survey;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Apr 2018 10:05:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replicate-number-in-PROC-SURVEYSELECT-in-a-macro/m-p/452757#M114296</guid>
      <dc:creator>GKati</dc:creator>
      <dc:date>2018-04-10T10:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate number in PROC SURVEYSELECT in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replicate-number-in-PROC-SURVEYSELECT-in-a-macro/m-p/452790#M114313</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;What if you replace&lt;/P&gt;&lt;PRE&gt;rep =(&amp;amp;i*&amp;amp;rep)+&amp;amp;rep&lt;/PRE&gt;&lt;P&gt;with&lt;/P&gt;&lt;PRE&gt;reps =%eval((&amp;amp;i*&amp;amp;rep)+&amp;amp;rep)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;... assuming that &amp;amp;rep is initialized somewhere ?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 13:15:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replicate-number-in-PROC-SURVEYSELECT-in-a-macro/m-p/452790#M114313</guid>
      <dc:creator>FloT</dc:creator>
      <dc:date>2018-04-10T13:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: Replicate number in PROC SURVEYSELECT in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replicate-number-in-PROC-SURVEYSELECT-in-a-macro/m-p/452827#M114319</link>
      <description>&lt;P&gt;Thanks for the responses. It does run with rep=%eval()..., but it does't give me the desired result after all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ended up creating a new variable in a subsequent data step. This works well.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro do_survey;
options mprint symbolgen;
%do i=0 %to 2;

proc surveyselect data=claims out=bootsample
     seed = 1347 method = urs
	 samprate = 1 outhits rep =&amp;amp;rep;
run;

ods listing close;

proc glm data=Bootsample;
class year(ref='2010' ) age_gr (ref='0' );
model indavgcost= year|avgcontract/ solution;
TITLE "ALL HOSPITALS-indavgcost";
by replicate;
ods output ParameterEstimates=work.t_&amp;amp;i;
run;

data t_&amp;amp;i;
set t_&amp;amp;i;
keep replicate parameter estimate;
run;

data t_&amp;amp;i;
set t_&amp;amp;i;
if estimate=0 then delete;
rep2=(&amp;amp;i*&amp;amp;rep)+replicate;
run;

proc datasets;
append base=t1 data=t_&amp;amp;i force;
run;
quit;

%end;
%mend do_survey;

%do_survey;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Apr 2018 13:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replicate-number-in-PROC-SURVEYSELECT-in-a-macro/m-p/452827#M114319</guid>
      <dc:creator>GKati</dc:creator>
      <dc:date>2018-04-10T13:49:29Z</dc:date>
    </item>
  </channel>
</rss>

