Let's learn few basics before going into depth
This is the first article in the series of Base SAS that covers the very basic things that a SAS analyst need to use day in day out.As there are too many things to learn about it, but we are covering are those things which are practically being used.
For that let's import a data into SAS. use the following file for the same.
proc import datafile = “Location\exam_results.csv.csv"
dbms = csv replace
out = data;
Getnames = yes;
guessingrows = 200;
run;
/* Below is the procedure to view the data in output window */
proc print data = class; run;
/* Below is the procedure to view the data in output window */
proc print data = class; run;
Now let's learn vertical sub-setting. So when keep / drop few variables off the data, I call it vertical sub-setting of data
data name_subject;
set class;
keep name subject;
Run;
data name_subject;
set class;
drop marks;
Run;
Both above codes are similar ... just two ways for saying same thing.
Now let's learn horizontal sub-setting on the basis of observations positions, without using any logic. We would learn logical sub-setting later while learning here and if ...
Options firstobs = 4 obs = 10;
Data subset ;
set class ;
drop subject ;
rename name = first_name ;
percentage = marks / 100;
format percentage percent5. ;
run ;
So under options, we have used firstobs and Obs for sub-setting.
Firstobs : instructs SAS, " Start data from here"
Obs : instructs SAS, " Take data up till here"
Few more basics :
> and GT are same
>= and GE are same
< and LT are same
<= and LE are same
= and EQ are same
~= and NE
are same
Enjoy reading our other articles and stay tuned with ...
Kindly do provide your feedback in the 'Comments' Section and share as much as possible.
No comments:
Post a Comment
Do provide us your feedback, it would help us serve your better.