12-16-2015 10:52 AM
I have a group of conditions in a excel sheet like this:
Cell A2: if name <> '' AND date < &date_ref then result=1;
Cell A3: else if name <> '' AND date > &date_ref then result=-1;
Cell A4: else result=0;
where &date_ref is a the reference to a SAS macro variable (like '01Nov2015:00:00:00'dt).
I have imported this sheet to a SAS dataset (cond_set), and now I would like to apply this conditions in a different dataset. Something like this:
data new_set; set test; <check those conditions here>; run;
Is this possible?
12-16-2015 10:57 AM - edited 12-16-2015 11:19 AM
Sure, you can either create a text file that contains the SAS code and run it, or create a few macro variables that are then resolved.
Here's an example of the first method. The second is relatively straightforward.
12-16-2015 11:55 AM
Whilst it may be technically possible to do this, I would advise you don't. Excel is not a SAS code editor. What is the purpose behind this? What conditions do you need to check? Is this to capture some user input or something? I can only say that trying to do things this way is going to cause you all kinds of problems - just to start with what kind of logic/syntax checking are you going to do on that spreadsheet? I can guarentee you every user will put something into the sheet that you don't expect and haven't handled for and it will go wrong.