- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;