* example 4.0 --- cancer99.dat raw data avaialable on web site; * no restrictions; data cancer99; infile "d:\sasclass\data\cancer99.dat";; input (county gender age cause) ($2. $1. 3. $4.); run; * records 101 through 200; data cancer99; infile "d:\sasclass\data\cancer99.dat" firstobs=101 obs=200; input (county gender age cause) ($2. $1. 3. $4.); run; * records 101 through end of file; data cancer99; infile "d:\sasclass\data\cancer99.dat" firstobs=101; input (county gender age cause) ($2. $1. 3. $4.); run; * first 100 records (default value of firstobs is 1); data cancer99; infile "d:\sasclass\data\cancer99.dat" obs=100; input (county gender age cause) ($2. $1. 3. $4.); run; * will not work; data cancer99; infile "d:\sasclass\data\cancer99.dat" firstobs=101 obs=100; input (county gender age cause) ($2. $1. 3. $4.); run; * no restrictions; data cancer99; infile "d:\sasclass\data\cancer99.dat";; input (county gender age cause) ($2. $1. 3. $4.); run; * use entire data file ... print first 5 observations; proc print data=cancer99 (obs=5); run; * use entire data file ... print observations 101 through 110; proc print data=cancer99 (firstobs=101 obs=110); run; * create a new data set from the old data set; data cancernew; set cancer99 (firstobs=101 obs=110); run; proc print data=cancernew; run; * create a new data set from the old data set - add an observation number; data cancernew; observ = 10 + _n_; set cancer99 (firstobs=11 obs=20); run; proc print data=cancernew; run;