We generally face this situation when we have company names or both first and last names of a person in our data set.
We can use a colon modifier “:” to tell SAS to read variable “Name” until there is a space or other delimiter. The $30. refers to the variable as a character variable having max length 30.
The colon modifier is also helpful to read numeric data that contains special characters such as comma(, ).
For example, if you want to read a variable which holds numeric values with the comma in thousands place (or thousand separators) then refer the code below.
In the above program, we have declared “fee” variable with colon modifier to load data and used $ sign to read this variable. It will be stored as a character variable. If you would not use $ sign, it will return missing values. Refer the program below how to store it as a numeric variable.
Note: comma5 format removes comma and store it as a numeric variable. 5 refers to the width of the input field. To read a bigger number such as 5, 000, 000, you can use comma10.
- SAS | How to read character using Ampersand(&)
- How to import data into SAS?
- Introduction to SAS programming
- How to import External Data from Excel or Text file into SAS Programming?
- How to Create or Modify a Variable in SAS Programming?
- Contains and Between-And operators in SAS Programming
- How to drop variables from a dataset in SAS Programming?
- Where Statement in SAS Programming
- If-Then-Else statement in SAS Programming
- IS MISSING and IS NOT MISSING Operators in SAS Programming
- Like Operator in SAS Programming
- SAS | How to specify a list of Variables?
- SAS | Date Formats and Informats
- SAS | Delete Empty Rows
- SAS | COALESCE Function with Examples
- SAS : How to Display Current Date?
- SAS | COMPRESS Function with Examples
- Find Location and Character Vector of an Object with partial name in R Language - apropos() and find() Function
- Automate mouse events using Java Robot Class
- SQL using C/C++ and SQLite
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.