DATA Step, Macro, Functions and more

date

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

date

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?


Accepted Solutions
Solution
‎03-15-2017 08:31 PM
PROC Star
Posts: 7,487

Re: date

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

 

Art, CEO, AnalystFinder.com

 

View solution in original post


All Replies
Solution
‎03-15-2017 08:31 PM
PROC Star
Posts: 7,487

Re: date

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

 

Art, CEO, AnalystFinder.com

 

Super User
Posts: 11,343

Re: date

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.

 

 

SAS Employee
Posts: 3

Re: date

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! 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 166 views
  • 3 likes
  • 4 in conversation