#Printing datasets in SAS
proc print data=work.intro;
run;
proc print data=work.intro;
where rating = 2;
run;
proc print data=work; where rating=2;
run;
proc print data=work.
intro;
where rating = 2;
run
proc PrINT data=Work.InTRo;
RuN;
proc print data=work.intro;
where post="ASE";
run;
proc print data=work.intro;
print var;
run;
data work.test;
x=12;
y=32;
z=212;
run;
proc print data=work.test;
run;
proc print data=work.test;
run;
data work.test;
input x y;
datalines;
3 4
23 5
232 5
23 5
;
run;
proc print data=work.test;
run;
In the above code: input x, y
would have resulted in an error.
Datalines, reads the data and moves to the next line.
data work.test;
input x y;
datalines;
3 4
23 5
232 5
23 5
;
run;
proc print data=work.test;
run;
Here it will take the first two lines only as space is the delimiter for SAS.
data work.test;
input x y;
datalines;
1 3 3
5 456 8
232 5 44
23 5 64
;
run;
proc print data=work.test;
run;
Assignment gets tricky in this way.
Speculation: It will take values for all or it will leave blank.
data work.test;
input x y z;
datalines;
1 3 3
5 456 8
232 5 44
23 5 64
;
run;
proc print data=work.test;
run;
Here, it won't assign anything, just will leave it blank.
data test;
inout x y;
datalines;
1
;
run;
proc print data=test;
run;
data work.test;
infile `path_to_file.txt';
input x y;
run;
proc print data=work.test;
run;
Characters end with a dollar sign.
data work.test;
infile `path_to_file.txt';
input name$ age salary;
run;
proc print data=work.test;
run;
So can't perform operations on age
data work.test;
infile `path_to_file.txt';
input name$ age$ salary;
run;
proc print data=work.test;
run;
Prints all
proc print data=work.test;
run;
proc means data=work.test;
var age;
run;
This will give error as data has to be sorted first.
proc means data=work.test;
var age;
by post;
run;
proc sort data=work.test;
run;
Now it will work.
proc means data=work.test;
var age;
by post;
run;
proc means data=work.test maxdesc=2;
var age;
by post;
run;
proc means data=work.test means;
var age;
by post;
run;
proc means data=work.test mean min max std;
var age;
by post;
run;
proc means data=work.test mean min max std median sum;
var age;
by post;
run;
Doesn't require data to be sorted first.
proc means data=work.test;
var age;
class post;
run;
* comments in sas;
\* both of these are multi
line comments */
proc print data=work.test;
run;