SAS
PROGRAMS FOR ABSOLUTE BEGINNERS BY AJEET KUMAR
/* SQL Program
Number: 1 */
data class;
set
sashelp.sonam;
run;
proc sql;
select Gender,
Height, Weight
from class
group by gender;
quit;
/* SQL Program
Number: 2 */
data class;
set
sashelp.sonam;
run;
proc sql;
select Gender,
avg(Height), avg(Weight)
from class
group by gender;
quit;
/* SQL Program
Number: 3 */
data class;
set
sashelp.sonam;
run;
proc sql;
select Gender,
avg(Height) 'Avearge Height', avg(Weight) 'Average Weight'
from class
group by gender;
quit;
/* SQL Program
Number: 4 */
data class;
set
sashelp.sonam;
run;
proc sql;
select Gender,
avg(Height) As AveargeHeight, avg(Weight) As AverageWeight
from class
group by gender;
quit;
/* SQL Program
Number: 5 */
data class;
set sashelp.sonam;
run;
proc sql;
select
mean(Height) 'Mean Height of All persons'
from class
/*group by
gender;*/
quit;
/* SQL Program
Number: 6 */
data class;
set
sashelp.sonam;
run;
proc sql;
select gender
,mean(Height) 'Mean Height of All persons'
from class
group by gender;
quit;
/* SQL Program
Number: 7 */
proc sql;
select gender
,state, mean(Height) 'Mean Height of All persons'
from good.class
group by gender ,
State;
order by gender,
state
quit;
/* SQL Program
Number: 8 */
proc sql;
select gender
,state, mean(Height) 'Mean Height of All persons'
from good.class
group by gender ,
State
order by gender,
state;
quit;
/* SQL Program
Number: 9 */
proc sql;
select state,
mean(Height) 'Mean Height of All persons'
from good.class
where Age > 12
group by state
order by State ;
quit;
/* SQL Program
Number: 10 */
proc sql feedback
;
select state,
mean(Height) 'Mean Height of All persons'
from good.class
where Age > 12
group by state
order by State ;
quit;
/* SQL Program
Number: 11 */
proc sql double ;
select state,
mean(Height) 'Mean Height of All persons'
from good.class
where Age > 12
group by state
order by State ;
quit;
/* SQL Program
Number: 12 */
proc sql feedback
number print;
select * from
class
order by gender;
quit;
/* SQL Program
Number: 13 */
proc sql print;
create table male
as
select name,
gender, state, age, remarks
from class
where gender='M';
quit;
/* SQL Program
Number: 14 */
proc copy
in=sashelp out=work;
select class;
run;
proc sql;
describe table
class;
quit;
proc sql;
create table WORK.Person(
bufsize=4096 )
(
Name char(8),
Sex char(1),
Age num,
Height num,
Weight num
);
quit;
/* SQL Program
Number: 15 */
proc sql;
select name
label='name of person' , age "Age of Person" , height format=5.2
from work.class;
No comments:
Post a Comment