DATA Step, Macro, Functions and more

my result contain extra column such as orderdate

Reply
Occasional Contributor
Posts: 7

my result contain extra column such as orderdate

data wombat.orderdata;
set wombat.orders;
if orderdate > '05JUN2003'
then bonous = 10;
run;

 

my result contain extra column such as orderdate and also bonous showing as . 

Super User
Posts: 19,855

Re: my result contain extra column such as orderdate

data wombat.orderdata;
set wombat.orders;
if orderdate > '05JUN2003'  <- You need to refer to a date literal with a d after the quotation mark '05Jun2003'd
then bonous = 10; <- If orderdate is less than or equal to date what do you want to happen with bonous variable?
run;

 


arun1234 wrote:

 

my result contain extra column such as orderdate and also bonous showing as . 


 

I bet your log has the answer. Read it. 

bonous is a variable you're trying to create, the condition is never true and you have no alternative value so it's set to missing.

Super User
Posts: 5,516

Re: my result contain extra column such as orderdate

If you are getting an extra column, it means that ORDERDATE is the wrong spelling for your existing variable.  Find the proper spelling and try again (following Reeza's advice to add the "d" to the date literal).

Ask a Question
Discussion stats
  • 2 replies
  • 158 views
  • 0 likes
  • 3 in conversation