Date: Mon, 19 Jun 2006 21:58:45 -0700
Reply-To: Jagadish <jagadishkr@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jagadish <jagadishkr@GMAIL.COM>
Subject: Working on String mathematical expressions
Content-Type: text/plain; charset="iso-8859-1"
I have a dataset which has a character variable called var1. Below are
the sample records of this dataset.
I want to create a new numeric variable say Var2 which is the result
the string expressions. The final dataset should look like,
I tried with the below code and it is working fine,
length var1 $100;
input var1 & $;
call symput('x', var1);
call execute('%let x=%Eval(&x);');
1+ 2 + 3
(3 + 4 ) * 5
(30 - 20) + 100
I just wanted to know is there any better way to do this. I mean
without usinng macro variables or is there any SAS function to handle
string math expressions?