BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
margi123
Fluorite | Level 6

Q )the following program submitted

data work.DATA_INFO;
X="01JAN1960"D;
Run;

What will be the value of X?

A.the numeric value 0
B.the character value "01jan1960"
C.the date value 01011960
D.code contains a syntax error

 

What is the answer and explain how it comes?

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

Answer A. 01jan1960 is the value 0. 02jan1960 is 1, 03jan1960 is 2, etc.

 

Art, CEO, AnalystFinder.com

 

View solution in original post

3 REPLIES 3
art297
Opal | Level 21

Answer A. 01jan1960 is the value 0. 02jan1960 is 1, 03jan1960 is 2, etc.

 

Art, CEO, AnalystFinder.com

 

ballardw
Super User

Did you run the code an examine the data set?

 

Look up SAS Date values. This a key bit of knowledge to work with SAS and dates.

 

 

jemayo
SAS Employee

SAS calculates dates as the number of days since January 1, 1960. Here, the date is exactly January 1, 1960, which is 0 days. So the answer to this question is 0.

 

Hope this explanation makes sense! 

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
  • 3 replies
  • 2396 views
  • 4 likes
  • 4 in conversation