I am very new to SAS and am struggling with how to define a global variable that can be used in many sql procs within my program
%LET seems to have a scope that is not global within my program..I'd like to declare a variable just once instead of having many %LET statements. My program has many SQL procs for different types of transaction monitoring. For example currently i have multiple proc sqls pulling data from the same table for various instruments, but i wanted to define a threshold in which i have a static value declared, like below:
%let x=10000;
Proc sql;
Select trans_amount, country from transactiontable
where trans_amount > &x
And ins_type in ('C')
Quit;
Proc sql;
Select trans_amount, country from transactiontable
where trans_amount > &x
And ins_type in ('D')
Quit;
Proc sql;
Select trans_amount, country from transactiontable
where trans_amount > &x
And ins_type in ('E')
Quit;
Here is the error message I am getting: WARNING: Apparent symbolic reference X not resolved. WARNING: Apparent symbolic reference X not resolved. 31 trans_amount> &X _ 22 ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, a missing value, BTRIM, INPUT, PUT, SUBSTRING, USER.
Please note Trans_amount is a numeric value derived from a sql table (numeric 8 digits).
Can some one help me or guide me to any literature that might help in declaring a variable only once instead of having to declare on %LET before every PROC sql?
I am wondering if this is SAS's way of telling me that i have a type mismatch error. Also the reason why i have to seperate the ins_type is because there is a need for seperate reports for the different ins_types.