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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.