I have the following code within a macro which goes from 1 to 2. Example data for ALL_KLMEAN1 and ALL_KLMEAN2 is included with the code.
DATA ALLA_KLMEAN&K;
SET nsum&K;
BY NREP;
IF uclm => 0.79 THEN ANSWER1=1;
IF uclm LT 0.79 THEN ANSWER1=0;
RUN;
option spool;
proc sql number;
CREATE TABLE FINAL AS
select UCLM, ANSWER1 ,NREP
from ALLA_KLMEAN&K;
QUIT;
Data: nrep lclm uclm Answer1
ALLA_KLMEAN1 1 -0.003 0.044 0
ALLA_KLMEAN2 2 -0.004 0.049 0
After the macro is run the table final only contains the results from ALL_KLMEAN2.. I want the final table to contain ALL_KLMEAN2
and ALL_KLMEAN1 results so it would look like this:
nrep uclm answer1
1 0.044 0
2 0.049 0
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.