Help using Base SAS procedures

adding a new date variable in the output dataset, format problems

Reply
Occasional Contributor
Posts: 11

adding a new date variable in the output dataset, format problems

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

Grand Advisor
Posts: 10,026

Re: adding a new date variable in the output dataset, format problems

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?

Respected Advisor
Posts: 3,124

Re: adding a new date variable in the output dataset, format problems

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

Grand Advisor
Posts: 9,444

Re: adding a new date variable in the output dataset, format problems

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

Ask a Question
Discussion stats
  • 3 replies
  • 122 views
  • 0 likes
  • 4 in conversation