BookmarkSubscribeRSS Feed
SeekYourWay
Calcite | Level 5

Hi there,

I'm trying to add a new date variable to a SAS data set.

While the code does run, the output is incorrect. I keep getting dates that are like in 1950s.

Is anybody able to assist?

code is:

A1 is another date column in the dataset.

Thanks

3 REPLIES 3
ballardw
Super User

Did you assign a date format such as mmddyy10. to the new variables? The integer values stored for dates in the third calendar quarter of 2011 (guessing from your dataset name) would be 18901 to 18993.

What results are you getting?

Haikuo
Onyx | Level 15

if the format year part of your date is in 2 digits, you may want to check out your cut off date, then adjust it accordingly.

proc options option=yearcutoff;

run;

     

Haikuo

Ksharp
Super User

I noticed you used 

.

Do you come from JAVA Forum at Oracle.com ? I also am there for a couple of days.

Now Focus on your question.

You did give us sample data and result you want.So just guess it.

your code

Start_Date=A1;

End_Date=Start_Date;

which means start_date and end_date both equal to A1, do you want it ?

Or you should change the order of these .

End_Date=Start_Date;

Start_Date=A1;

about '1950' , you can use some format or function year(A1) to get it .

Good Luck.

Ksharp

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 907 views
  • 0 likes
  • 4 in conversation