Text and character informats

Last changed: 03 October 2019

 

In order to read text variable we use the $ sign when reading the data from the editor. After that the variable will always be handled as text (or character) variable.  SAS normally only reads the first 8 characters of a text variable, which gives problems if you have several entries that start with the same 8 letters. Then you need to specify the length of the text (e.g. 15 letters) in the input statement:

input date: ddmmyy10. type: $15. concent;

Generally it is difficult to handle text variables that also include a space, e.g. new treatment and old treatment. The best way to solve this is to use short indicators (e.g. A and B and than use a format on this variable. Also

input date: ddmmyy10. type: & $15. concent;

might do the trick.


Contact