@GN0001 wrote:
Hello team,
I have this code:
data storm_cat;
set pg1.storm_summary;
keep Name Basin MinPressure StartDate PressureGroup;
*add ELSE keyword and remove final condition;
if MinPressure=. then PressureGroup=.;
else if MinPressure<=920 then PressureGroup=1;
else PressureGroup=0;
run;
PressureGroup is created after the keep statement. How does keep statement knows about
PressureGroup?
Your response is greatly appreciated.
GN
There are statements that SAS refers to as "Declaritive".
Declarative statements supply information to SAS and take effect when the system compiles program statements.
The order of most of these does not matter though the position may look "odd" in some contexts, especially if you get in a particular coding habit. Exceptions are Data (start a data step) Cards/Cards4/Datalines/Datalines4 which precede in-line data at the end of a step, and the End which ends a DO or Select block. Length may go anywhere but could generate some warnings about variables that exist.
Declarative Statements
|
ARRAY
|
DATALINES4
|
Labels, Statement
|
ATTRIB
|
DROP
|
LENGTH
|
BY
|
END
|
RENAME
|
CARDS
|
FORMAT
|
RETAIN
|
CARDS4
|
INFORMAT
|
WHERE
|
DATA
|
KEEP
|
WINDOW
|
DATALINES
|
LABEL
|