We normally think about information administration techniques passive software program that receives information from different sources. Nonetheless, the info step within the SAS language stands out for its effectivity and energetic position in creating and storing information.
Let’s create a brand new dataset with one variable, ‘x,’ and assign it one worth in a single row.
The ‘output’ assertion is essential in understanding how the ‘information’ step processes information. The information step reads (or generates) the info report by report, and when it encounters the ‘output’ assertion, it writes that report to the info file within the assigned library (or ‘work’ if no library is assigned).
So, within the final instance, the one remark generated (with the variable x=1) is written to the info file “t.OneVar” solely when the “output” assertion is encountered.
Due to this fact, if we modify this code to be as within the following code.
This code would end in a dataset with one remark the place the variable x takes the worth “2”.
The information step must embrace a couple of “output” assertion or studying information from some supply to generate a couple of remark. For instance, we will use the “do” assertion to create a loop and insert the “output” assertion.
That may generate a dataset with ten observations. Or we may learn the values of the variable “x” from a “datalines” assertion as follows:
The “enter” assertion is used to learn information from a supply. When the assertion “datalines” is included within the information step (earlier than the “run” command), the “enter” command will learn the values from the values between the “datalines;” and the semicolon (;).
The variable “x” is an instance of a numeric variable. The SAS language has solely two atomic kinds of variables: numeric and string. String variables could possibly be outlined instantly by assigning them values. For instance,
An alternative choice is to learn information from “datalines;” or a file. On this case, the “enter” command will know {that a} variable is of the kind “string” by inserting “$” after its identify.