BookmarkSubscribeRSS Feed
arun1234
Calcite | Level 5

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 . 

2 REPLIES 2
Reeza
Super User

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.

Astounding
PROC Star

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).

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 599 views
  • 0 likes
  • 3 in conversation