title: Macro is converting numeric inputs to character. How to change it back to numeric?
body: <p>I created a macro to split a dataset into a training and validation set. I noticed that the following %if statement was not evaluating correctly and recently learned that it's because the macro processor <a href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a001071862.htm" rel="nofollow noreferrer">does not make a distinction between character and numeric values as the rest of SAS does</a> (link to SAS documentation). I confirmed this by using the %eval function as shown below:</p>
  
  <pre><code>%else %if %eval(&amp;split) &lt;= 0 or %eval(&amp;split) &gt;= 1 %then %do;
      %put ERROR: The specified split of the data must be within the following range of real numbers (0,1].;
  %end;
  </code></pre>
  
  <p>How can I fix this so that it will read my input for the macro variable "split" correctly as a decimal? </p>
  
  <p>The following sample code can be used:</p>
  
  <pre><code>data test (drop=i);
  do i=1 to 1000;
  a=round(uniform(1)*4,.01);
  b=round(uniform(1)*10,.01);
  c=round(uniform(1)*7.5,.01);
  if b&lt;2 then d=1;
  else d=0;
  if i&lt;500 then y=1;
  else y=0;
  output;
  end;
  stop;
  run;
  
  %macro train_valid(split=);
      %if &amp;split =  %then %put ERROR: Missing an input. Check to make sure the macro variable has an input.;
      %else %if &amp;split &lt;= 0 or &amp;split &gt;= 1 %then %do;
          %put ERROR: The specified split of the data must be within the following range of real numbers (0,1].;
      %end;
      %else %do;
          proc surveyselect data=test samprate=&amp;split seed=1000 out=Sample outall 
              method=srs noprint;
           run;
          data test_train; 
              set Sample; 
                  where selected = 1;
          run; 
          data test_valid;
              set Sample; 
                  where selected = 0;
          run;
      %end; 
  %mend;
  %train_valid(split=.75);
  </code></pre>