Given the three lines of data:1,3,5,72,4,6,89,8,7,6 write a SAS DATA step to read these data, assigning the four data values to the variables X1 to X4
Question
Given the three lines of data:
1,3,5
72,4,6
89,8,7
6
Write a SAS DATA step to read these data, assigning the four data values to the variables X1 to X4.
Solution
Sure, here is a simple SAS DATA step to read the data:
DATA test;
INFILE datalines DLM=',';
INPUT X1 X2 X3 X4;
DATALINES;
1,3,5,7
2,4,6,8
9,8,7,6
;
RUN;
Here's a step-by-step explanation:
-
DATA test;
This line starts a new DATA step and creates a new data set named "test". -
INFILE datalines DLM=',';
The INFILE statement is used to read raw data. "datalines" is a special SAS keyword that allows you to input data directly into the program. The DLM option specifies that the data is delimited by commas. -
INPUT X1 X2 X3 X4;
The INPUT statement tells SAS the names of the variables to create (X1, X2, X3, X4) and the order to read them in. -
DATALINES;
This line signals the start of the data lines to be read. -
The next three lines are the data to be read into the variables X1, X2, X3, X4.
-
;
This line signals the end of the data lines. -
RUN;
This line tells SAS to execute the DATA step.
Similar Questions
Find the mean, median, and mode of the data set. (Enter DNE for any values that do not exist.)8 4 7 4 6
Given a file ``data.txt`` with three columns of data separated by spaces, read it into one complex sequence.
Find the mean, median, and mode of the data set. (Enter DNE for any values that do not exist.)9 2 8 2 5 4
Find the sample standard deviation for the datax 1 2 3 4 5 6 7 8 9 10f 384 208 98 56 28 12 8 2 3 1Round to three decimals.
If the mode of the following data is 7, then the value of k in the data set 3, 8, 6, 7, 1, 6, 10, 6, 7, 2k+5, 9, 7, and 13 is:a.1b.3c.4d.7
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.