Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The following code examples provide a collection of more advanced PUT, SET, MERGE, and SQL operations. You are encouraged to work through each DATA step and PROC SQL query in sequence to develop more insight into DATA step manipulation and data set construction.
/* ==================================================== */
/* PUT examples... */
/* ==================================================== */
data;
put "Hello World!!!";
put @20 "Hello World!!!"; * start at column 20;
put 3*"Hello World!!!"; * 3 copies;
run;
data;
put;
put "Hello World!!!" /;
put @20 "Hello World!!!" /; * start at column 20;
put 3*"Hello World!!!" /; * 3 copies;
put;
run;
data;
input name $ @@;
put "Hello " name ", welcome to SAS Statistical Programming." /;
datalines;
Dave Hal
;
run;
data;
file " C:\Users\baileraj.IT\Desktop\put-example.TXT";
* replace path in FILE with folder on your system;
input name $ @@;
put "Hello " name ", welcome to SAS Statistical Programming." /;
datalines;
Dave Hal
;
run;
/* ==================================================== */
/* CONCATENATING ("row binding") data sets */
/* ==================================================== */
/* clean example */
data d1;
input v1 v2 v3;
datalines;
1 2 3
4 5 6
;
run;
data d2;
input v1 v2 v3;
datalines;
11 12 13
14 15 16
17 18 19