BookmarkSubscribeRSS Feed
Babloo
Rhodochrosite | Level 12

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?

 

 

1 REPLY 1
DartRodrigo
Lapis Lazuli | Level 10

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 7971 views
  • 1 like
  • 2 in conversation