Is there a way to extract the result (value=CHAR/NUMERIC) of the &datatyp
macro into a variable that is available to the data step that is attempting
to execute the macro? For instance, following the call to the macro I would
code a statement like IF whatever = 'CHAR' THEN DELETE;. The test below
appears to show that at least it is evaluating the data as I expected but I
can't seem to find a way to get the values CHAR or NUMERIC into a variable
that I can reference. I've tried numerous variations and have gotten it to
generate a VARIABLE named CHAR but not a VALUE!
Thanks in advance for any help/hints
DBA (& apparent SAS non-programmer attempting to play one at work)
508 %macro NumTest;
509 %if %datatyp(&Number)=NUMERIC %then %do;
510 %put The MemberName "&number" is NUMERIC.;
512 %else %do;
513 %put Error: The MemberName "&number" contains CHARs.;
515 %mend NumTest;
517 *FILENAME PDSDIR 'D:/TEMP/PDSDIR.TXT';
518 *FILENAME CONTROLS 'D:/TEMP/CONTROLS.TXT';
519 /* Step 1: Read, test & keep the #nnnn member names */
520 Data Dir;
521 Infile Cards;
522 Input @1 Tag $Char1. @;
523 If Tag = '#';
524 Input @2 NumberC $Char4.;
525 Call symput("Number",NumberC);
526 Call execute('%numtest');
The MemberName "0000" is NUMERIC.
Error: The MemberName "000A" contains CHARs.
The MemberName "0002" is NUMERIC.
The MemberName "0003" is NUMERIC.
The MemberName "0005" is NUMERIC.
NOTE: The data set WORK.DIR has 5 observations and 2 variables.
NOTE: DATA statement used:
real time 0.11 seconds
NOTE: CALL EXECUTE routine executed successfully, but no SAS statements were