WARNING: Argument 2 to function PUTC referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range

3.1k views Asked by At

I am trying to use the product of a Proc Format statement as the format in a %sysfunc statement as so:

proc format;
value myvar
1 = "One" 2 = "Two" 3 = "Three" 4 = "Four";
run;

%let i = 1;

%let dvar = %sysfunc(putc(&i, $myvar.));
%put &dvar;

However I keep getting the error in the title of the post:

WARNING: Argument 2 to function PUTC referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.

Can anyone tell me why this is?

Thanks

1

There are 1 answers

0
gdogg371 On BEST ANSWER

This worked for me in the end:

proc format;
value myvar
1 = "One" 2 = "Two" 3 = "Three" 4 = "Four";
run;

%let i = 1;

%let dvar = %sysfunc(putn(&i, myvar.));
%put &dvar;

Thanks