You are on page 1of 3

libname YourName 'E:\YourName';

proc copy in = local out = YourName;


select cars candy candy_customers candy_products;
run;

proc print data = local.cars (firstobs = 10 obs = 20 drop = type model)


double label noobs N split = '*';
label gastank = 'Gas *of the* Tank';
sum weight;
run;

proc print data = local.candy;


run;

proc sort data = local.cars out = sortedcars;


by type;
run;

proc print data = sortedcars n;


id model;
var gastank country;
sum weight;
by type;
run;

proc print data = local.cars;


class type;
run;

data cars;
set local.cars;
rename type = typeofcar;
proc print data =cars label ;
label typeofcar = 'type of carasmodified';
run;

proc contents data = cars;


run;

data tcars (keep = type);


set local.cars(firstobs = 10 obs = 20);
run;

data tcars (firstobs = 10 obs = 20);


set local.cars;
run;

proc print data = local.cars n;


where type = 'Small' & weight < 2600;
/*where type = 'Small' or type = 'Compact';*/
/*where type ? 'S';*/
/*where type in ('Small','Compact');*/
run;
data cars_small cars_others;
set local.cars;
if weight > 2700 & type = 'Small' then delete;
if type = 'Small' then output cars_small;
else output cars_others;
run;

proc print data = local.candy;


run;

data candy (keep = cholesterol healthcheck);


set local.candy;
select (cholesterol);
when (20) healthcheck = 'Too high, to be careful';
when (15) healthcheck = 'Take medicines';
when (10) healthcheck = 'Control oil';
when (5) healthcheck = ' Good care';
otherwise healthcheck = 'Very healthy';
end;
run;

data tcars;
set cars_small cars_others;
run;

data cs;
set cars_small;
run;

proc append base= cs data = cars_others;


run;

proc print data = cs;


run;

data emp1;
input id name$;
datalines;
101 sri
103 YourName
106 she
;
run;

data emp2;
input id name$;
datalines;
102 aish
104 hri
109 sach
;
run;
data memp;
merge emp1 emp2;
by id;
run;

proc freq data = local.cars;


table type * turningradius;
run;

proc means data = local.cars;


var weight;
class type;
run;

You might also like