data a;
infile 'C:\Users\d\Downloads\text.bin';
input len pib1. @;
input charvar $varying127. len @ ;
run;
Can you explain me how determine number after 'varying'? And if you have some documents about that give me please?
i want ask you this question, can i read 1 byte instead reading 2 byte ? I tried this code but it didn't work
You should be able to use PIB1. to read a one byte binary character as an integer. Set the width used in the $VARYING. informat based on the maximum number of characters that could be in that field. So if your length is specified by a single byte then the maximum will be 255. Also make sure that the variable you are reading the string into is long enough.
Use the LIST statement to see what your data looks like. For example you might try reading it using fixed length records just to make it easier to read the logs. Here is a little program to read the first 1,000 bytes of a file in records of length 100.
data _null_;
infile 'C:\Users\d\Downloads\text.bin' lrecl=100 recfm=f obs=10 ;
input;
list;
run;
Use the $HEX. format to see the codes for the characters that you have already read into a variable.
data _null_;
infile 'C:\Users\d\Downloads\text.bin' recfm=n ;
input str $char50. ;
put str $hex100. ;
run;
... View more