Hello,
I have a group of conditions in a excel sheet like this:
CellA1: condition
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?
Best regards,
Brunosm
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.
http://www2.sas.com/proceedings/sugi29/175-29.pdf
Hello Reeza,
thanks for the reply but... I can't see the examples...
Thanks!
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.
Hello RW9,
thanks for the reply. I think you are... right!
I'm going to try a different approach and i'll give feedback on this.
Thanks a lot
Brunosm
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.