SAS | How to specify a list of Variables? Last Updated : 23 Jul, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report Suppose you have a list of variables. You don't want to type the name of each variable every time to define them within the function or array. You are looking for a shortcut to accomplish this task. Create a dataset with a list of variables SQL data dummy; input a1 a3 a4 a2 a6$ bs$ a5; cards; 2 1 3 5 aa xy 2 2 5 4 1 ab xz 4 2 7 3 9 ac wx 3 ; run; Output: How to specify a list of variables A single dash (-) refers to specify consecutive numbered variables. For example: a1-a4; A double dash (--) refers to specify variables based on the order of the variables as they appear/entered in the file, regardless of the name of the variables. SQL data dummy1 (drop= a1--a5); set dummy; sum = sum(of a1-a4); sum1 = sum(of a1--a4); run; Output: In the above program, a1-a4 includes a1, a2, a3 and a4, whereas a1--a4 includes a1, a3 and a4 only as they appear the same way in file. How to specify all NUMERIC variables SQL data dummy1 (drop= a1--a5); set dummy; sum = sum(of _numeric_); run; Output: How to use double dash in array The below-defined program will subtract one from values in variables a1, a3 and a4. SQL data dummy1; set dummy; array vars a1--a4; do over vars; vars = vars - 1; end; run; Output: How to use numeric variables in array The below-defined program will subtract one from values in numeric variables. SQL data dummy1; set dummy; array vars _numeric_; do over vars; vars = vars - 1; end; run; Output: Comment More infoAdvertise with us Next Article List Variables in Workspace With Sizes and Types in MATLAB S ShubhamMaurya3 Follow Improve Article Tags : Software Engineering SAS Programming Similar Reads How to Create or Modify a Variable in SAS Programming? This will help you to create or modify a variable. It is common to define a new variable based on the existing variable. Let's create a dataset In the code below, we are creating a dataset named as Example1 which is going to store on WORK(temporary) library. In this dataset, there would be a variabl 2 min read How to drop variables from a dataset in SAS Programming? This topic is regarding how to drop variables from a dataset in SAS. It includes various methods to delete variables from data. In SAS, there are two ways to drop variables: DROP = data set option DROP statement Let's start with creating a data set: SQL DATA outdata; INPUT roll_num gender $ class su 2 min read Set Variable Data Types in MATLAB There are many cases when a user has to import data into MATLAB script from various files. These file types could be .txt, .xlsx, .csv, .dat, etc. types. Now, each file type has its own method of defining data types. However, for computation purposes, MATLAB requires the data to be of numeric type, 3 min read How to import data into SAS? Entering Data Directly: You can enter numbers of lines of data directly in SAS program by using a DATALINES statement. The keywords are as follows: DATA: The DATA step always starts with a DATA statement. The purpose of the DATA statement is to tell SAS that you are creating a new data set i.e. outd 3 min read List Variables in Workspace With Sizes and Types in MATLAB MATLAB works with workspaces, which contain all variables, and their metadata. This makes accessing data in large codes easy. However, sometimes there are requirements for listing all the variables in the MATLAB terminal or properties of some particular variables. Fortunately, MATLAB provides a met 2 min read SAS | How to read character of varying length using COLON Modifier 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 leng 2 min read Like