Newvar = expression;
classmonth = 01; classday = 12; classyear = 2000; classdate = mdy(classmonth, classday, classyear);Another way to define the variable classdate is as follows:
classdate = '12Jan2000'd;Notice the "d" after the quoted date text, telling SAS you are defining a date.
Both these methods create a SAS date. SAS dates are the number of days from January 1, 1960. When printed, you will see the value of this variable as a SAS date, unless you format it.
format classdate mmddyy10.;
Hw1=5; hw2=10; hw3=7; HWtotal = sum(hw1, hw2, hw3); Hwavg = mean(hw1, hw2, hw3);
Citystate = 'Corvallis, OR'; Comma = scan(citystate, ','); City = substr(citystate,1,comma-1); State = substr(citystate, comma+2, length(citystate));