data ds;
infile datalines;
input id$ name$ age sex$;
datalines;
101 vinod 22 m
102 kumar 23 m
103 suresh 24 m
104 kalesh 25 m
105 firek 26 f
109 haiek 24 f
;
run;
proc sql;
create table work.ds1 as SELECT 'Total' AS id,count(name) AS name, count(age) as age, count(sex) as sex FROM work.ds
GROUP BY age;
run;
data ds2;
set ds ds1;
run;
223 data ds;
224 infile datalines;
225 input id$ name$ age sex$;
226 datalines;
NOTE: The data set WORK.DS has 6 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
233 ;
234 run;
235
236 proc sql;
237 create table work.ds1 as SELECT 'Total' AS id,count(name) AS name, count(age) as age, count(sex)
237! as sex FROM work.ds
238
239 GROUP BY age;
NOTE: Table WORK.DS1 created, with 5 rows and 4 columns.
240 run;
NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.
241
NOTE: PROCEDURE SQL used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
242 data ds2;
243 set ds ds1;
ERROR: Variable name has been defined as both character and numeric.
ERROR: Variable sex has been defined as both character and numeric.
244 run;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.DS2 may be incomplete. When this step was stopped there were 0
observations and 4 variables.
WARNING: Data set WORK.DS2 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
i want to addup the two datasets of subgroups and grand total also
plz rectify