<?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: Accessing corresponding numeric value from a dataset using macro variable inside a macro in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581775#M13726</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;872  data x_trans;
873   infile cards;
874   input n c_tot c_etopfa c_sb c_lb;
875   ln=log(n);
876   dummy=1;
877   datalines;

NOTE: The data set WORK.X_TRANS has 1 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


879  ;
880  run;

881  %macro rate1(dat,vars);
882  %do i = 1 %to %sysfunc(countw(&amp;amp;vars.));
883      %put %scan(&amp;amp;vars., &amp;amp;i.);
884      %LET newv=%scan(&amp;amp;vars., &amp;amp;i.);
885
886      data new_Results;
887      set &amp;amp;dat.;
888      proc genmod data=&amp;amp;dat.;
889      model  %scan(&amp;amp;vars., &amp;amp;i.) = / offset=ln dist=poisson lrci;
890      estimate 'Mean' intercept 1;
891      title " cases for in &amp;amp;newv";
892      run;
893
894
895
896      proc print data=new_Results;
897      id n %scan(&amp;amp;vars., &amp;amp;i.);
898      inputval=INPUT(SYMGET(%scan(&amp;amp;vars., &amp;amp;i.));
899      IR=inputval/n;
900      IR_1K=IR*1000;
901      LC=quantile('chisq',0.025, inputval*2)/(n*2);
902      UC=quantile('chisq',0.975, (inputval+1)*2)/(n*2);
903      res_l=LC*1000;
904      res_u=UC*1000;
905      title "rate per 1K  another way";
906      run;
907
908  %END;
909
910  %mend rate1;

911  %run_pr(x_trans,c_tot);
c_tot

NOTE: There were 1 observations read from the data set WORK.X_TRANS.
NOTE: The data set WORK.NEW_RESULTS has 1 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


NOTE: Writing HTML Body file: sashtml4.htm


NOTE: Fitting saturated model. Scale will not be estimated.
NOTE: Algorithm converged.
NOTE: The scale parameter was held fixed.
NOTE: PROCEDURE GENMOD used (Total process time):
      real time           0.84 seconds
      cpu time            0.26 seconds


ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric
       operand is required. The condition was: NUVAR
ERROR: The macro RUN_PR will stop executing.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I am getting&lt;/P&gt;</description>
    <pubDate>Fri, 16 Aug 2019 16:38:32 GMT</pubDate>
    <dc:creator>sigma_exp</dc:creator>
    <dc:date>2019-08-16T16:38:32Z</dc:date>
    <item>
      <title>Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581754#M13724</link>
      <description>&lt;P&gt;So I am running into some issues here:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following is the macro I am running to estimate the rate per 1000. The PROC GENMOD is running without any issue, however, in the second part where I am trying to access the same variable and perform some arithmetic operation, it is throwing the following error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;" Statement is not valid or it is used out of proper order"&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wondering it has to do with accessing the macro variable and corresponding numeric value from the dataset internally. But not quite getting the coding right. Any feedback or suggestion is appreciated!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro rate1(dat,vars);
%do i = 1 %to %sysfunc(countw(&amp;amp;vars.));
	%put %scan(&amp;amp;vars., &amp;amp;i.);
	%LET newv=%scan(&amp;amp;vars., &amp;amp;i.);

	data new_Results; 
	set &amp;amp;dat.;
	proc genmod data=&amp;amp;dat.;
	model  %scan(&amp;amp;vars., &amp;amp;i.) = / offset=ln dist=poisson lrci;
	estimate 'Mean' intercept 1;
	title " cases for in &amp;amp;newv";
	run;



	proc print data=new_Results;
	id n %scan(&amp;amp;vars., &amp;amp;i.);
	inputval=INPUT(SYMGET(%scan(&amp;amp;vars., &amp;amp;i.));
	IR=inputval/n;
	IR_1K=IR*1000;
	LC=quantile('chisq',0.025, inputval*2)/(n*2);
	UC=quantile('chisq',0.975, (inputval+1)*2)/(n*2);
	res_l=LC*1000;
	res_u=UC*1000;
	title "rate per 1K  another way";
	run;

%END;

%mend rate1;


%run_pr(x_trans,c_tot);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Aug 2019 16:05:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581754#M13724</guid>
      <dc:creator>sigma_exp</dc:creator>
      <dc:date>2019-08-16T16:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581772#M13725</link>
      <description>&lt;P&gt;You might want to show us the code for the run_pr macro.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 16:31:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581772#M13725</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2019-08-16T16:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581775#M13726</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;872  data x_trans;
873   infile cards;
874   input n c_tot c_etopfa c_sb c_lb;
875   ln=log(n);
876   dummy=1;
877   datalines;

NOTE: The data set WORK.X_TRANS has 1 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


879  ;
880  run;

881  %macro rate1(dat,vars);
882  %do i = 1 %to %sysfunc(countw(&amp;amp;vars.));
883      %put %scan(&amp;amp;vars., &amp;amp;i.);
884      %LET newv=%scan(&amp;amp;vars., &amp;amp;i.);
885
886      data new_Results;
887      set &amp;amp;dat.;
888      proc genmod data=&amp;amp;dat.;
889      model  %scan(&amp;amp;vars., &amp;amp;i.) = / offset=ln dist=poisson lrci;
890      estimate 'Mean' intercept 1;
891      title " cases for in &amp;amp;newv";
892      run;
893
894
895
896      proc print data=new_Results;
897      id n %scan(&amp;amp;vars., &amp;amp;i.);
898      inputval=INPUT(SYMGET(%scan(&amp;amp;vars., &amp;amp;i.));
899      IR=inputval/n;
900      IR_1K=IR*1000;
901      LC=quantile('chisq',0.025, inputval*2)/(n*2);
902      UC=quantile('chisq',0.975, (inputval+1)*2)/(n*2);
903      res_l=LC*1000;
904      res_u=UC*1000;
905      title "rate per 1K  another way";
906      run;
907
908  %END;
909
910  %mend rate1;

911  %run_pr(x_trans,c_tot);
c_tot

NOTE: There were 1 observations read from the data set WORK.X_TRANS.
NOTE: The data set WORK.NEW_RESULTS has 1 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


NOTE: Writing HTML Body file: sashtml4.htm


NOTE: Fitting saturated model. Scale will not be estimated.
NOTE: Algorithm converged.
NOTE: The scale parameter was held fixed.
NOTE: PROCEDURE GENMOD used (Total process time):
      real time           0.84 seconds
      cpu time            0.26 seconds


ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric
       operand is required. The condition was: NUVAR
ERROR: The macro RUN_PR will stop executing.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I am getting&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 16:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581775#M13726</guid>
      <dc:creator>sigma_exp</dc:creator>
      <dc:date>2019-08-16T16:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581776#M13727</link>
      <description>&lt;P&gt;Looks like the macro run_pr has a bug.&lt;/P&gt;
&lt;P&gt;Do you have the source code that macro?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 16:44:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581776#M13727</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-16T16:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581779#M13728</link>
      <description>&lt;P&gt;This is the code I wrote.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro rate1(dat,vars);
%do i = 1 %to %sysfunc(countw(&amp;amp;vars.));
	%put %scan(&amp;amp;vars., &amp;amp;i.);
	%LET newv=%scan(&amp;amp;vars., &amp;amp;i.);

	data new_Results; 
	set &amp;amp;dat.;
	proc genmod data=&amp;amp;dat.;
	model  %scan(&amp;amp;vars., &amp;amp;i.) = / offset=ln dist=poisson lrci;
	estimate 'Mean' intercept 1;
	title " cases for in &amp;amp;newv";
	run;



	proc print data=new_Results;
	id n %scan(&amp;amp;vars., &amp;amp;i.);
	inputval=INPUT(SYMGET(%scan(&amp;amp;vars., &amp;amp;i.));
	IR=inputval/n;
	IR_1K=IR*1000;
	LC=quantile('chisq',0.025, inputval*2)/(n*2);
	UC=quantile('chisq',0.975, (inputval+1)*2)/(n*2);
	res_l=LC*1000;
	res_u=UC*1000;
	title "rate per 1K  another way";
	run;

%END;

%mend rate1;


%run_pr(x_trans,c_tot);&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Aug 2019 16:54:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581779#M13728</guid>
      <dc:creator>sigma_exp</dc:creator>
      <dc:date>2019-08-16T16:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581784#M13729</link>
      <description>&lt;P&gt;Unless proc print has changed a lot since version 9.4M4 none of the highlighted code is valid in Proc Print:&lt;/P&gt;
&lt;PRE&gt;proc print data=new_Results;
897      id n %scan(&amp;amp;vars., &amp;amp;i.);
&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;898      inputval=INPUT(SYMGET(%scan(&amp;amp;vars., &amp;amp;i.));
899      IR=inputval/n;
900      IR_1K=IR*1000;
901      LC=quantile('chisq',0.025, inputval*2)/(n*2);
902      UC=quantile('chisq',0.975, (inputval+1)*2)/(n*2);
903      res_l=LC*1000;
904      res_u=UC*1000;
&lt;/FONT&gt;&lt;/STRONG&gt;905      title "rate per 1K  another way";
906      run;
&lt;/PRE&gt;
&lt;P&gt;Print does just that, Prints. It can do some column sums but those other calculations are right out.&lt;/P&gt;
&lt;P&gt;Also the INPUT function would require a format and I strongly suspect you do not actually have the macro variable you would be attempting to reference with that SYMGET call.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 17:12:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581784#M13729</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-08-16T17:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581785#M13730</link>
      <description>&lt;P&gt;Why did you send the code for the macro RATE1 when you are not calling that macro?&lt;/P&gt;
&lt;P&gt;You are calling the macro RUN_PR.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 17:15:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581785#M13730</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-16T17:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581787#M13731</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/284713"&gt;@sigma_exp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;This is the code I wrote.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro rate1(dat,vars);
%do i = 1 %to %sysfunc(countw(&amp;amp;vars.));
	%put %scan(&amp;amp;vars., &amp;amp;i.);
	%LET newv=%scan(&amp;amp;vars., &amp;amp;i.);

	data new_Results; 
	set &amp;amp;dat.;
	proc genmod data=&amp;amp;dat.;
	model  %scan(&amp;amp;vars., &amp;amp;i.) = / offset=ln dist=poisson lrci;
	estimate 'Mean' intercept 1;
	title " cases for in &amp;amp;newv";
	run;



	proc print data=new_Results;
	id n %scan(&amp;amp;vars., &amp;amp;i.);
	inputval=INPUT(SYMGET(%scan(&amp;amp;vars., &amp;amp;i.));
	IR=inputval/n;
	IR_1K=IR*1000;
	LC=quantile('chisq',0.025, inputval*2)/(n*2);
	UC=quantile('chisq',0.975, (inputval+1)*2)/(n*2);
	res_l=LC*1000;
	res_u=UC*1000;
	title "rate per 1K  another way";
	run;

%END;

%mend rate1;


%run_pr(x_trans,c_tot);&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you create newv macro variable but never use it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 17:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581787#M13731</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-16T17:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581791#M13732</link>
      <description>still not seeing the code for run_pr...can't help you without it.</description>
      <pubDate>Fri, 16 Aug 2019 17:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581791#M13732</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2019-08-16T17:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581792#M13733</link>
      <description>that's the code for rate1.  We need to see the code for run_pr.  Get it?</description>
      <pubDate>Fri, 16 Aug 2019 17:29:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581792#M13733</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2019-08-16T17:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581794#M13734</link>
      <description>&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;NOTE&lt;/SPAN&gt;: The &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; WORK&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;NEW_RESULTS has &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; observations and &lt;SPAN class="token number"&gt;7&lt;/SPAN&gt; variables&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If your subset has 1 observation then you cannot run a regression. Something is wrong with your input data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 17:32:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581794#M13734</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-16T17:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581796#M13735</link>
      <description>&lt;P&gt;My mistake: please see the code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;&lt;BR /&gt;%macro rate1(dat,vars);
%do i = 1 %to %sysfunc(countw(&amp;amp;vars.));
	%put %scan(&amp;amp;vars., &amp;amp;i.);
	%LET newv=%scan(&amp;amp;vars., &amp;amp;i.);

	data new_Results; 
	set &amp;amp;dat.;
	proc genmod data=&amp;amp;dat.;
	model  %scan(&amp;amp;vars., &amp;amp;i.) = / offset=ln dist=poisson lrci;
	estimate 'Mean' intercept 1;
	title " cases for in &amp;amp;newv";
	run;



	proc print data=new_Results;
	id n %scan(&amp;amp;vars., &amp;amp;i.);
	inputval=INPUT(SYMGET(%scan(&amp;amp;vars., &amp;amp;i.));
	IR=inputval/n;
	IR_1K=IR*1000;
	LC=quantile('chisq',0.025, inputval*2)/(n*2);
	UC=quantile('chisq',0.975, (inputval+1)*2)/(n*2);
	res_l=LC*1000;
	res_u=UC*1000;
	title "rate per 1K  another way";
	run;

%END;

%mend rate1;


%rate1(x_trans,c_tot);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Aug 2019 17:37:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581796#M13735</guid>
      <dc:creator>sigma_exp</dc:creator>
      <dc:date>2019-08-16T17:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581798#M13736</link>
      <description>&lt;P&gt;As a count data, I have the parameter estimates and without running the MACRO, in a DATA with PROC GENMOD, it is running without giving any error.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 17:39:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581798#M13736</guid>
      <dc:creator>sigma_exp</dc:creator>
      <dc:date>2019-08-16T17:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581799#M13737</link>
      <description>When I run as a DATA step without using macro, it gives out the specific estimates. For example, instead of using "inputval", if I directly use the "c_tot") with the data=new_Results, it has those estimates. I wonder how can I access the value of "c_tot" by referencing it as a macro variable and perform the arithmetic operations? I guess this is a better way to rephrase my original question.</description>
      <pubDate>Fri, 16 Aug 2019 17:42:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581799#M13737</guid>
      <dc:creator>sigma_exp</dc:creator>
      <dc:date>2019-08-16T17:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581805#M13738</link>
      <description>You're right, technically no errors.&lt;BR /&gt;&lt;BR /&gt;NOTE: Fitting saturated model. Scale will not be estimated.&lt;BR /&gt;NOTE: Algorithm converged.&lt;BR /&gt;NOTE: The scale parameter was held fixed.</description>
      <pubDate>Fri, 16 Aug 2019 18:00:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581805#M13738</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-16T18:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581806#M13739</link>
      <description>&lt;P&gt;So now run the updated program. Add the line:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Before the macro call.&amp;nbsp; The MPRINT lines in the LOG will show you what code your macro generates. Try to figure out how to have it generate the code you actually want.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 18:02:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581806#M13739</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-16T18:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581807#M13740</link>
      <description>&lt;P&gt;Let's try this one more time: &lt;BR /&gt;Proc print will not let you do calculations in the code. Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;534  proc print data=sashelp.class;
535
536  heightweight = height/weight;
     ------------
     180
ERROR 180-322: Statement is not valid or it is used out of proper order.
537  run;

&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;FONT color="#ff0000" size="4"&gt;So this proc print step is going to Fail:&lt;/FONT&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;	proc print data=new_Results;
	id n %scan(&amp;amp;vars., &amp;amp;i.);
	inputval=INPUT(SYMGET(%scan(&amp;amp;vars., &amp;amp;i.));
	IR=inputval/n;
	IR_1K=IR*1000;
	LC=quantile('chisq',0.025, inputval*2)/(n*2);
	UC=quantile('chisq',0.975, (inputval+1)*2)/(n*2);
	res_l=LC*1000;
	res_u=UC*1000;
	title "rate per 1K  another way";
	run;
&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/PRE&gt;
&lt;P&gt;Fail. Period. End of story. Doesn't matter what data set is used, what erroneous macro variables may be involved, &lt;STRONG&gt;every&lt;/STRONG&gt; statement with an = shown is an error.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 18:05:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581807#M13740</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-08-16T18:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581809#M13741</link>
      <description>thank you for clarifying --you are absolutely right. In fact, it is because you pointed it out, I was able to find the bug. I am posting the updated code below. It fixes the problem. Thanks again!</description>
      <pubDate>Fri, 16 Aug 2019 18:15:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581809#M13741</guid>
      <dc:creator>sigma_exp</dc:creator>
      <dc:date>2019-08-16T18:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581810#M13742</link>
      <description>&lt;P&gt;So here is the updated macro I wrote.&amp;nbsp; It fixes the problem and generates the output I was looking for. Thank you all for providing valuable feedback and input to get me to write this one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro rate1(dat,vars);
%do i = 1 %to %sysfunc(countw(&amp;amp;vars.));
	%put %scan(&amp;amp;vars., &amp;amp;i.);
	*%LET newv=%scan(&amp;amp;vars., &amp;amp;i.);

	data new_Results; 
	set &amp;amp;dat.;
	proc genmod data=&amp;amp;dat.;
	model  %scan(&amp;amp;vars., &amp;amp;i.) = / offset=ln dist=poisson lrci;
	estimate 'Mean' intercept 1;
	title " cases for in &amp;amp;newv";
	run;



	data new_Results2;
	set &amp;amp;dat.;
	IR=%scan(&amp;amp;vars., &amp;amp;i.)/n;
	IR_1K=IR*1000;
	LC=quantile('chisq',0.025, %scan(&amp;amp;vars., &amp;amp;i.)*2)/(n*2);
	UC=quantile('chisq',0.975, (%scan(&amp;amp;vars., &amp;amp;i.)+1)*2)/(n*2);
	res_l=LC*1000;
	res_u=UC*1000;
	run;
	
	
	proc print data=new_Results2;
	id n %scan(&amp;amp;vars., &amp;amp;i.);
	title "rate per 1K  another way";
	run;

%END;

%mend rate1;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Aug 2019 18:17:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581810#M13742</guid>
      <dc:creator>sigma_exp</dc:creator>
      <dc:date>2019-08-16T18:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing corresponding numeric value from a dataset using macro variable inside a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581821#M13743</link>
      <description>&lt;P&gt;Why do you have the first two of these three lines?&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	data new_Results; 
	set &amp;amp;dat.;
	proc genmod data=&amp;amp;dat.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What do you think the first two lines are doing?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 18:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Accessing-corresponding-numeric-value-from-a-dataset-using-macro/m-p/581821#M13743</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-16T18:36:37Z</dc:date>
    </item>
  </channel>
</rss>

