Creating Multiple Observations
The majority of the SAS data sets contain multiple observations.
In order to create a data set that contains more than 1 observation, you need the Input and Datalines statements.
Input and Datalines Statement
Example
Data Test;
Input a b c;
Datalines;
1 3 4
2 7 9
12 444 123
;
Run;
(1) Input Statement
The Input statement lists the variables to be created.
In our example, the Input statement tells SAS to create 3 variables: a, b and c
(2) Datalines
Datalines statement signals SAS to begin reading the data on the next line.
Together with these statements, you can create a data set with multiple observations.
Exercise
Create a data set that contains the following variables:
Name the data set as SCORE.
Need some help?
HINT:
The semi-colon must be placed on the NEXT line after the last line of data.
SOLUTION:
Data Score;
Input Score1 Score2 Score3;
Datalines;
77 88 35
93 57 74
67 85 71
;
Run;
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |