SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Nietzsche
Lapis Lazuli | Level 10

Hi I am trying to learn how to read the SAS documentation.

I am reading the output statement on SAS documentation page, on the top it says that this statement is valid in DATA step. 

 

but in programming 1 tutorial, it is in PROC MEANS, so does that mean the statement in the documentation that OUTPUT is valid in DATA step is no exhaustive or complete? There are other places OUTPUT statement can be used?

 

 

Ben_in_Canberra_0-1665954768016.png

 

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Make sure you look at the documentation for the right OUTPUT statement.

Here are just a few that appear with a google search: https://www.google.com/search?q=%40sas.com+output+statement

 


OUTPUT Statement - SAS Help Center

https://documentation.sas.com › statug_hpqtr_syntax07
Variables that you name in an ID statement are also copied from the input data set to the output data set. keyword <=name>. specifies the statistics to include ...
OUTPUT Statement - SAS Help Center
https://documentation.sas.com › doc › statug › statug_h...
The OUTPUT statement creates a data set that contains predicted values and residual diagnostics, computed after fitting the model. By default, all variables ...
 
OUTPUT Statement - SAS Help Center
https://documentation.sas.com › statug_pls_syntax07
You use the OUTPUT statement to specify a data set to receive quantities that can be computed for every input observation, such as extracted factors and ...
 

OUTPUT Statement - SAS Help Center

https://documentation.sas.com › doc › pgmsascdc › statug
If you use multiple OUTPUT statements, then PROC SURVEYIMPUTE uses only the first OUTPUT statement and ignores the rest. The OUTPUT OUT= data set contains all ...

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

The OUTPUT statement in a DATA step does DATA step things. The documentation for the DATA step version of the OUTPUT statement is probably exhaustive and complete for what the OUTPUT statement does in a DATA step.

 

The OUTPUT statement in a PROC has a totally different meaning, which is usually specific to each PROC. You would need to read the PROC MEANS documentation to see what OUTPUT does in PROC MEANS.

--
Paige Miller
Tom
Super User Tom
Super User

Make sure you look at the documentation for the right OUTPUT statement.

Here are just a few that appear with a google search: https://www.google.com/search?q=%40sas.com+output+statement

 


OUTPUT Statement - SAS Help Center

https://documentation.sas.com › statug_hpqtr_syntax07
Variables that you name in an ID statement are also copied from the input data set to the output data set. keyword <=name>. specifies the statistics to include ...
OUTPUT Statement - SAS Help Center
https://documentation.sas.com › doc › statug › statug_h...
The OUTPUT statement creates a data set that contains predicted values and residual diagnostics, computed after fitting the model. By default, all variables ...
 
OUTPUT Statement - SAS Help Center
https://documentation.sas.com › statug_pls_syntax07
You use the OUTPUT statement to specify a data set to receive quantities that can be computed for every input observation, such as extracted factors and ...
 

OUTPUT Statement - SAS Help Center

https://documentation.sas.com › doc › pgmsascdc › statug
If you use multiple OUTPUT statements, then PROC SURVEYIMPUTE uses only the first OUTPUT statement and ignores the rest. The OUTPUT OUT= data set contains all ...
Kurt_Bremser
Super User

When you have the documentation of the OUTPUT statement in a data step open, scroll up in the navigation pane, open "Base SAS Procedures", then "Base SAS Procedures Guide", then "Procedures". There you'll find the MEANS Procedure, where the use of the procedure-specific OUTPUT statement is explained.

 

SAS statements with identical spelling can appear in different places, where they have (sometimes slightly, sometimes radically) different functions.

Nietzsche
Lapis Lazuli | Level 10

so what the difference between sas programming and sas base procedure? Why does SAS institute it so confusing?

Python is python, R is R. 

Why is SAS Base, SAS programming, SAS procedure etc? It is so confusing.

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).
Kurt_Bremser
Super User

The SAS system has multiple languages.

The DATA step language is Turing-complete.

There is SQL, in two flavors (the SQL procedure, and the more modern FEDSQL procedure).

And all the procedures have their own "mini-language", as the procedures are prefabricated modules, where the "language" is just a way to feed parameters into the module.

 

Keep in mind that SAS is WAY more powerful than R, as it covers the whole analytical process, from ETL to Statistics to Reporting.

PaigeMiller
Diamond | Level 26

so what the difference between sas programming and sas base procedure?

SAS programming is simply code you write in SAS. SAS Base (maybe you mean "Base SAS") is a part of the SAS software that you have to purchase to use SAS; you can choose to purchase additional parts of the SAS language. Some people colloquially refer to Base SAS as one of the many interfaces through which you can create and execute SAS code.

 

Python is python, R is R. 

SAS does not have to have the same features or language design as other software.

--
Paige Miller

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1315 views
  • 5 likes
  • 4 in conversation