CALL PUTC(c-source, format <, new-string <, return-code >> )
CALL PUTN(n-source, format <, new-string <, return-code >> )
specifies a character constant, constant, variable, or expression to which you want to apply the format.
specifies a numeric constant, constant, variable, or expression to which you want to apply the format.
formatcontains a string with the SAS format that you want applied to the value that is specified in the source. ...
specifies a character variable in which to place the formatted value.
specifies a numeric variable for which received a return-code of 0,1 or 2
do x = '00', 'AA';
call putc(x, "$A.", y, rc);
if rc ne 0
then call missing (y);
Intended purpose? As in why is this needed?
It seems like the only thing different from PUTN and PUTC is your return code. Which might mean from the return code 1 that a whole lot of changes to the way formats are currently created would be needed.
I am sure I am not the only person that will create a format that only explicitly formats a small range of values such as age < 18 to create that as a group but leaves the other ages "undefined" or not explicitly listed. Which might be considered as no match but I know that going in.
If I were worried about explicit contents of the FORMAT then use cntlout option in Proc Format to create a data set and then you have something in a data set to check.
That is fair. OK.
When defining a value format, it's good practice to set a value for other, which can then be used to detect a mismatch. Given this, the current put, putc and putn functions already do what you want, just in a slightly different way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.