I used this code, but I have over 8,000 observations. When I use this code, I only see my first three observations. I am sure there is an easier code without putting each dataline in. Thanks for the help
data deaths;
input year day month;
format new ddmmyy8.;
new=mdy(month,day,year);
datalines;
1999 1 1
1999 1 2
1999 1 3
;
run;
data new;
set oldDataSet;
newDate = mdy(month, day, year);
format newDate ddmmyy8.;
run;
Assuming you already have a data set with the day, month, year referencing it with a SET statement instead is what you want to do.
@kimmialex wrote:
I used this code, but I have over 8,000 observations. When I use this code, I only see my first three observations. I am sure there is an easier code without putting each dataline in. Thanks for the help
data deaths;
input year day month;
format new ddmmyy8.;
new=mdy(month,day,year);
datalines;
1999 1 1
1999 1 21999 1 3
;
run;
I don't see anything combining "three columns" so it appears that you have skipped a bunch of step, like how you combined, what on, what your start looks like and what you expect the result to look like.
If you mean "create a date variable" from month, day and year variable you have the right function (likely) but you don't show the use of any existing data set which would go on a set statement such as:
data newdataset; set existingdatasetname; format new ddmmyy8.; /* assuming the data set on the SET statement has numeric variables named month, day and year and year is 4 digits*/ new=mdy(month,day,year); run;
If "deaths" was the name of your data set you have replaced it and need to re-create it.
data new;
set oldDataSet;
newDate = mdy(month, day, year);
format newDate ddmmyy8.;
run;
Assuming you already have a data set with the day, month, year referencing it with a SET statement instead is what you want to do.
@kimmialex wrote:
I used this code, but I have over 8,000 observations. When I use this code, I only see my first three observations. I am sure there is an easier code without putting each dataline in. Thanks for the help
data deaths;
input year day month;
format new ddmmyy8.;
new=mdy(month,day,year);
datalines;
1999 1 1
1999 1 21999 1 3
;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.
Ready to level-up your skills? Choose your own adventure.