Last time I used SAS was when it was in version 5.x. My company's current version is 9.3 and since I'm the only one available with any SAS history, I'm suddenly the "expert". A lot has changed but I have the programmer's bookshelf and existing code for examples. My problem, for which I would be most grateful for a solution, is that I can't seem to "format" an INPUTted binary value into a CHAR value and assign it to a CHAR var, and make the CHAR var stay as a CHAR var. To wit: DATA _NULL_; INFILE SYSRECIN END=FILE_EOF; INPUT @01 REC $CHAR3676.; ORD_NO_BIN = INPUT(SUBSTR(REC,1,4),IB4.); ORD_NO_TYP = SUBSTR(REC,5,1); ORD_NO_CHK_DGT = SUBSTR(REC,6,1); ORD_SEQ_NO = INPUT(SUBSTR(REC,7,2),IB2.); ORD_TX_LEN = INPUT(SUBSTR(REC,9,2),IB2.); ORD_TX = SUBSTR(REC,11,ORD_TX_LEN); ORD_NO_7 = PUTC(ORD_NO_BIN,7.); [this and 2 dozen other ways to force ORD_NO_BIN to a CHAR value have failed] ORD_NO_CURR = ORD_NO_TYP || ORD_NO_7|| ORD_NO_CHK_DGT; FILE SASLIST; PUT ORD_NO_CURR= ; ... My output recs can be as much as 2000 or more characters long, when each row of output should be exactly 9 characters. An example DESIRED output line might look like: C12345678 Where the C is ORN_NO_TYP and 8 is ORD_NO_CHK_DGT. 1234567 is the binary/integer numeric input, stored on the input file as 4 bytes, and limited to a maximum value of '0098967F'X (which is 9999999 in decimal). What I'm actually getting, using the above ideal example of C12345678, is: C[anything from 300 or so spaces up to a few thousand]8 I've tried PUT() and PUTC() with various combinations of $CHAR7, $7, $Z7, etc. I've tried converting the input to a combination of INPUT with PUT(SUBSTR()). Above, you see my latest attempt at using a completely new (and otherwise useless) variable in an attempt to force the numeric value in ORD_NO_BIN to a char value in a new char var, ORD_NO_7. My goal is not the printing of ORD_NO_CURR. I'm printing to help debug the problem. My goal is to assemble all 3 parts of an Order Number into a single character variable that I can use later in the program. I have verified that if I actually PUT ORD_NO_CURR to a real output file, it shows up in the file the same way it shows up in print. Please, can someone suggest how I can get the input 4-byte binary value of ORD_NO_BIN to become a 7-byte character variable (and STAY a char var) until I can concatenate it with the other 2 parts into a single Order Number variable, ORD_NO_CURR? Thanks a lot! SAS has changed a whole lot since the last time I used and I just don't seem to be able to find my way around... Richard
... View more