the two codes below produced the same result. So what is the point of the output; statement?
data cars2 (drop=color); set spg.cars; if color='G'; output; run; proc print data=cars2;run;
data cars2 (drop=color); set spg.cars; if color='G'; run; proc print data=cars2;run;
In this example, the outcome is the same. But there are numerous examples where an explicit Output Statement is quite handy. In your example, there is an implicit Output Statement (And Return Statement) at the bottom of the Data Step.
Consult the Output Statement Doc for information and examples.
In this example, the outcome is the same. But there are numerous examples where an explicit Output Statement is quite handy. In your example, there is an implicit Output Statement (And Return Statement) at the bottom of the Data Step.
Consult the Output Statement Doc for information and examples.
In the simple example you have, OUTPUT really has no impact, but in other cases OUTPUT could be useful.
Example:
data cars2 (drop=color);
set spg.cars;
if color='G';
/* perform some complicated calculation that takes 10 steps and generates a value in variable RESULT */
if result<0 then output;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.