data dm;
infile 'C:\Documents and Settings\mobileclub\Desktop\source\DLM\customers.txt';
input cno $ bcd $ pcd $ month goods;
run;
proc sql;
select pcd,month,count(pcd)as frq 'no of customer' from dm
group by month,pcd ;
quit;
/*one dimesional report -summarized*/
data product;
infile 'C:\Documents and Settings\mobileclub\Desktop\source\DLM\sales-data.txt';
input state $ pcd $ area $ month stock sale;
run;
proc sql;
select state,
sum(sale) as sm 'total sale',
mean(sale) as ags 'aveage sale',
max(sale) as mx 'maximum sale',
min(sale) as mn 'minumum sale',
std(sale) as sd 'deviation in sale' from product
group by state;
quit;
/*two dimensional*/
proc sql;
select state,area,
sum(sale) as sm 'total sale',
mean(sale) as ags 'aveage sale',
max(sale) as mx 'maximum sale',
min(sale) as mn 'minumum sale',
std(sale) as sd 'deviation in sale' from product
group by state,area;
quit;
/*multidimensional*/
proc sql;
select state,area,pcd,
sum(sale) as sm 'total sale',
mean(sale) as ags 'aveage sale',
max(sale) as mx 'maximum sale',
min(sale) as mn 'minumum sale',
std(sale) as sd 'deviation in sale' from product
group by state,area,pcd;
quit;
/*multiple analysis variables*/
proc sql;
select state,
max(stock) as mxst 'maximum stock',
max(sale) as mxs'maximum sale',
min(stock) as mnst 'minumum stock',
min(sale) as mns'minumum sale' from product
group by state;
quit;
/*summarized report -for data validation*/
data medi;
input pid visit dose;
cards;
101 1 0.5
102 1 0.10
103 1 0.15
101 2 0.5
102 2 0.10
103 2 0.15
101 3 0.5
102 3 0.10
103 3 0.15
;
proc sql;
select pid ,count(pid) as frq 'no of visits' from medi
group by pid;
quit;
proc sql;
select visit ,count(visit) as frq 'no of subjects' from medi
group by visit;
quit;
proc sql;
select pid,visit ,count(visit) as frq 'no of times' from medi
group by pid,visit;
quit;
proc sql;
select pid,visit ,dose,count(dose) as frq 'no of times' from medi
group by pid,visit,dose;
quit;
No comments:
Post a Comment