Skip to content

Instantly share code, notes, and snippets.

@abhishekdagarit
Last active October 12, 2017 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhishekdagarit/2a6ee96f1b4dc2293f35784d13de9e7d to your computer and use it in GitHub Desktop.
Save abhishekdagarit/2a6ee96f1b4dc2293f35784d13de9e7d to your computer and use it in GitHub Desktop.
SAS rules

SAS rules

Case sensitive

SAS in not case sensitive.

proC PrinT daTa = woRK.IntrO;
WHerE Rating = 2;
run;

SAS is case sensitive while comparing.

proc print data = work.InTro;
where rating = 2;
run;

Spaces don't matter

proc print data = work.intro; where rating =2; run     ;

Variables in SAS

proc print data = work.intro;
where rating = 2;
run;

\\rating is a variable here

Work library

Work is the default library.

data test5;
input x y p q;
datalines;
1 2 55
3 4 77
5 6 99
7 8 33
9    10 44
;
run;

proc print data = test5;
run;

Data step

data work.test;
x=12;
y=34;
z= 35;
run;

Proc step

proc print data = work.test;
run;

Data types in SAS

There are only two datatypes in SAS. char and numbers.

Characters end with a dollar sign.

data work.test9;
input name$ age salary;
datalines;
a 23 442323
b 43 23423423
c 32 4242443
d 44 3242424
;
run;

proc print data = work.test9;
run;

Can't perform numeric operations on characters.

Comma is usually not required

Comments in SAS

There are two ways to mention comments in SAS

* class post;
* semicolon is needed;
/*  class post; */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment