in the first line why do we list the three tables first?
if we don't list them, why doesn't the output statement create the tables as they do when we use output statement elsewhere?
why is there no equal sign after output?
lastly why do we need ; before output sometimes but other times don't?
how can i can make sense of these things?
@jaliu wrote:
in the first line why do we list the three tables first?
To declare these as output tables. This is the required syntax within a Data step.
if we don't list them, why doesn't the output statement create the tables as they do when we use output statement elsewhere?
I believe you're referring to the OUTPUT statement in PROCS which have an OUT= option that allows you to then specify the data set name. The OUTPUT statement functions different in a data step (compared to a proc) where you are not required to specify the output data set name, but can specify the output data set name. If you have multiple data sets specified in the DATA statement but do not specify the data set in the OUTPUT statement, it is written to all datasets.
why is there no equal sign after output?
Because that is the data step syntax for a data set OUTPUT statement.
I think you may be confusing some of the OUT= options in other procs with the OUTPUT statement. Even with PROC MEANS which has an OUTPUT statement, there's an OUT= to specify the data set name.
lastly why do we need ; before output sometimes but other times don't?
Not sure this is true or correct. Please expand further with examples.
how can i can make sense of these things?
Read the documentation very, very closely.
You seem to be confusing options and statements at the moment for starters.
Please post code as text in the future, and please put a descriptive subject line. This post has nothing to do with IF/THEN DO statements so if someone now searches for help with an IF/THEN question this comes up and is not helpful.
@jaliu wrote:
in the first line why do we list the three tables first?
if we don't list them, why doesn't the output statement create the tables as they do when we use output statement elsewhere?
why is there no equal sign after output?
lastly why do we need ; before output sometimes but other times don't?
how can i can make sense of these things?
You can also distribute output observations to multiple datasets without explicit output statements. You could use "where" flters in the data statement:
data indian (where=(oceancode='I'))
atlantic (where=(oceancode='A'))
pacific (where=(oceancode not in ('A','I')) ;
set og1.strom_summary;
length ocean $8;
keep basic season name maxwindmph ocean;
basin=upcase(basin);
oceancode=substr(basin,2,1);
if ocenacode="I' then ocean="Indian";
else if oceancode="A" then ocean="Atlantic";
else ocean="Pacific";
run;
SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.
Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!
For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.
Find more tutorials on the SAS Users YouTube channel.