Data is generated directly in the code using the 'cards' statement.
1 Code Block
DATA STEP Data
Explanation : Creation of the 'dummy' table. The 'input' statement reads 5 variables. Raw data is provided line by line, and SAS continues reading on subsequent lines to complete an observation.
Explanation : Transformation step: reading the 'dummy' table and creating new variables containing descriptive statistics (Max, Min, Sum, Median, Mean, Square root) calculated horizontally across variables X1 to X5.
Copied!
data dummy;
set dummy;
max = max(X1,X2,X3,X4,X5);
min = min(X1,X2,X3,X4,X5);
sum = sum(X1,X2,X3,X4,X5);
median = median(X1,X2,X3,X4,X5);
mean = mean(X1,X2,X3,X4,X5);
sqrt = sqrt(sum(X1,X2,X3,X4,X5));
run;
1
DATA dummy;
2
SET dummy;
3
max = max(X1,X2,X3,X4,X5);
4
min = min(X1,X2,X3,X4,X5);
5
sum = sum(X1,X2,X3,X4,X5);
6
median = median(X1,X2,X3,X4,X5);
7
mean = mean(X1,X2,X3,X4,X5);
8
sqrt = sqrt(sum(X1,X2,X3,X4,X5));
9
RUN;
3 Code Block
PROC PRINT
Explanation : Displaying the resulting 'dummy' dataset in standard output.
Copied!
proc print data= dummy;
run;
1
PROC PRINTDATA= dummy;
2
RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.