DATA Step, Macro, Functions and more

Colon Modifier

Reply
Super Contributor
Posts: 435

Colon Modifier

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?

 

 

Regular Contributor
Posts: 212

Re: Colon Modifier

[ Edited ]

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.

Ask a Question
Discussion stats
  • 1 reply
  • 1310 views
  • 1 like
  • 2 in conversation