abhishekdagarit
9/19/2017 - 3:27 PM

Printing in SAS

Printing in SAS

Printing a dataset

proc print data = d1;
run;

Printing only one variable

proc print data = d1;
var a;
run;

Printing observations in SAS

Printing without observations

proc print data = work.test2 noobs;
run;

Defines last observations

proc print data = work.test2(obs=7);
run;

Defines first observation

proc print data = work.test2(obs=7);
run;

Defines first and last observation

proc print data = work.test2(firstobs=3 obs=7);
run;

Defining length of a variable

Alignment needed.Do not use if the data is not aligned.

data test;
input name$1-10 age salary;
datalines;
ak das 23 23432432432;
bk sharma 24 234324234;
ck verma 31 2343290923;
dk gupta 12 2343242;
run;

Here it will not work fine.

Can be used at multiple places
data test;
input name$1-10 age13-14 salary14-18;
datalines;
...
...
...
...
run;

Placement of the numbers doesn't matter. Can be moved around.

data test;
input name$1-10 salary14-15 age 13-14;
datalines;
...
...
...
...
run;

Possible to create another variable from existing variables.

data test;
input name$1-10 firstname$1-5 lastname$6-10 age salary;
datalines;
...
...
...
...
run;