PROC SQL;
CREATE TABLE SL_1 AS
SELECT distinct A,AEC,'Patients ' AS VARIABLE, 1 AS GRP, COUNT(DISTINCT SUBJID) AS CNT
FROM A(WHERE=(FL='Y')) GROUP BY AEC
UNION ALL
SELECT distinct A,AEC,'Patients 2' AS VARIABLE, 2 AS GRP, COUNT(DISTINCT SUBJID) AS CNT
FROM A(WHERE=(FL='Y' AND FFL='N')) GROUP BY AEC
;quit;
How to write above code in Data step
In general you wouldn't combine those types of calculations with the step that combines the datasets into one data step.
To combine two datasets (aka UNION) just use the SET statement.
data want;
set have1 have2;
run;
What if I have three tables that want to union?
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: