Search notes:

SAS: creating a dataset with the datalines statement

A data set can be created from data that is stored with the source code with a datalines statement:
data tq84_ds;  /* Create dataset ds */
  put "before: " _all_;

  length v1 $26;
  length v2 $17;

  input      num v1 v2;

  inpcount +   1;
  sumx     + num;

  put "after: " _all_;
datalines;
42 foo I-say_hello-world
999 bar-baz computer
1 abcdefghijklmnopqrstuvwxyz screen
;

/* Output of put:
before: v1=  v2=  num=. inpcount=0 sumx=0 _ERROR_=0 _N_=1
after: v1=foo v2=I-say_hello-world num=42 inpcount=1 sumx=42 _ERROR_=0 _N_=1
before: v1=  v2=  num=. inpcount=1 sumx=42 _ERROR_=0 _N_=2
after: v1=bar-baz v2=computer num=999 inpcount=2 sumx=1041 _ERROR_=0 _N_=2
before: v1=  v2=  num=. inpcount=2 sumx=1041 _ERROR_=0 _N_=3
after: v1=abcdefghijklmnopqrstuvwxyz v2=screen num=1 inpcount=3 sumx=1042 _ERROR_=0 _N_=3
before: v1=  v2=  num=. inpcount=3 sumx=1042 _ERROR_=0 _N_=4
*/



proc print data=tq84_ds;
run;
Github repository about-SAS, path: /programming/data-sets/create-with-datalines.sas

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Companie...', 1759408323, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Companies-Products/SAS/programming/data-sets/datalines(64): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78