Reputation: 12701
How do you ADD an instrument variable to an existing definition? using code? eg:
proc risk;
environment new = work.Test ;
declare instvars=(var1 num var, var2 num var, var3 num var);
instrument MyInst variables = ( var1, var2 ) ;
environment save;
run;
proc risk;
environment open= work.Test;
instrument MyInst variables= ( /* how do I add var3? */);
environment save;
run;
There must be an easy way! If not - how can one determine the original definition (programmatically) ?
To expand on the requirement - I cannot update the original instrument definition, as this is inherited from a production environment. Also - I do not wish to hardcode the original instrument variables in the second instrument statement, in case the original environment changes.
I think there might not be another way (other than hard coding) but open to ideas!
Upvotes: 1
Views: 1463
Reputation: 12701
Got there - with a bit of help! Without using the Risk Dimensions UI, or rewriting the instrument statement, the only other way is to use the dataset created by the WRITETYPES statement.
proc risk;
environment new = work.Test ;
declare instvars=(var1 num var, var2 num var, var3 num var);
instrument MyInst variables = ( var1, var2 ) ;
writetypes out=temp;
environment save;
run;
proc sql;
insert into temp set insttype='MyInst', type='VAR', content='VAR3';
proc sort data=temp; by _all_; run;
proc risk;
environment open= work.Test;
readtypes data=temp;
environment save;
run;
Upvotes: 1