Hello all!
In a mainframe environment, SAS 9.1.3 Service Pack 4
I am attempting to read in a file in a group of variables, the number of variables depends on the file record length and the number of columns I want in each variable.
Meaning, if the file length is 80, and I want blocks of data 10 columns long, I need it to create 8 different variables and read them in with positions in relation to the variable.
@01 VARBLK1
@11 VARBLK2 and so on
The four variables bolded will be assigned by the user, but can change at any time. In my code below, I need the INTN (being the variable name) so I can make sense of the information I receive
I was trying the following code with no success.
%LET NWLOC = %FILEDATA(CMPFILE1,6);
%LET BLK = 10 ;
%LET PRIMSTR = 001 ;
%LET PRIMFMT = 9. ;
%LET PRIMVAR = INTN ;
DATA FRSTFILE;
INFILE
CMPFILE1
MISSOVER END=LASTREC
;
FLELNGTH = INPUT(&NWLOC,5.);
BLKSIZE = INPUT(&BLK,5.);
VARNM = FLELNGTH/BLKSIZE;
CALL SYMPUT('VARNUM',VARNM);
SELECT ( &BTCH_FILE_TYPE );
WHEN ( 'BLOCK' )
INPUT
@ &PRIMSTR &PRIMVAR &PRIMFMT @;
ARRAY FLEBLK (&VARNUM);
DO I = 0 TO &VARNUM;
@((I*&BLK)+ 1) FLEBLK(I) $CHAR&BLK.@;
END;
END;
RUN;
Currently, I run into this.... Line generated by the macro variable "VARNUM".
80/10
ERROR 180-322: Statement is not valid or it is used out of proper order.
I assume it is because the VARNUM isn't actually performing the calculation as I had hoped. Alternate suggestions or approaches would be greatly appreciated.