May I request someone to explain me about colon modifer in simple terms? Why it is necessary in input statement? What will happen when we read the input without colon modifer whereit is necessary to place the colon modifer?
Hi mate,
First you need to understand how your data is getting in your dataset. This is why you use input statement, you are going to input your data into your dataset.
The colon ( : ) modifier enables you to read nonstandard data values and character values that are longer than eight characters, but which contain no embedded blanks. The : indicates that values are read until a blank (or other delimiter) is encountered, and then an informat is applied. If an informat for reading character values is specified, the w value specifies the variable's length, overriding the default length.
In order to read these values, you can modify list input with the colon ( : ) modifier, followed by the COMMAw.d informat, as shown in the program below. Notice that the COMMAw.dinformat does not specify a w value. |
Remember that list input reads each value until the next blank is detected. The default length of numeric variables is 8, so you don't need to specify a w value to indicate the length of a numeric variable.
This is different from using a numeric informat with formatted input. In that case, you must specify a w value in order to indicate the number of columns to be read.
Reading Nonstandard Values and That Mysterious Colon ( : )
Hope this helps.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.