title: SAS macro write text file with char and num parameter
body: <p>I am trying to write a macro that creates a text file using parameter value. I understand all SAS parameters are passed as text, so i need to convert the text to numeric. Using INPUT for this but still getting a syntax error. Appreciate the help. Thank you.</p>
  
  <p><strong>code:</strong></p>
  
  <pre><code>%macro test(n_var);
  
    data _null_;
  
      file"c:/temp/test.txt" TERMSTR=crlf;
  
      put ;
      put "(numeric variable passed = "input(&amp;n_var,8.)")";
      put ;
  
    run;
  
  %mend;
  
  %test(n_var=100);
  </code></pre>
  
  <p><strong>Log:</strong></p>
  
  <pre><code>SYMBOLGEN:  Macro variable N_VAR resolves to 100
  NOTE: Line generated by the macro variable "N_VAR".
  39         100
             ___
             22
             76
  MPRINT(TEST):   put "(numeric variable passed = "input(100,8.)")";
  MPRINT(TEST):   put ;
  MPRINT(TEST):   run;
  
  ERROR 22-322: Syntax error, expecting one of the following: a name, arrayname, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.  
  
  ERROR 76-322: Syntax error, statement will be ignored.
  </code></pre>