Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 2. Reading, Combining, and Manag... > 2.10 Self-Study Laboratory Explorati...

2.10 Self-Study Laboratory Explorations

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

					  


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint