turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Re: Why are dates changing -- and why is intck not...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

3 weeks ago

My current code is.

1. The "svcdate" variable in the "have" dataset starts with 2010 dates but for some reason in the "want" dataset output, I only get dates that are based on 1960s (resembles more like the patient's birthdates)

2. my enrolled_days_tot are showing up as "." in the output dataset

Anybody know what is going on here? Thank you so much!

```
data want;
do until(last.enrolid);
set have;
where (dx1 in (&dx1_list.) or dx2 in (&dx1_list.) or dx3 in (&dx1_list.) or dx4 in (&dx1_list.))
and age >=&age_cutoff.;
by enrolid enroll_start_dt enroll_end_dt;
if first.enrolid then index_dt=svcdate and enrolled_days_tot=intck('days', enroll_end_dt, enroll_start_dt);
format index_dt date11.;
output;
end;
keep enrolid enroll_start_dt enroll_end_dt index_dt enrolled_days_tot;
run;
```

Accepted Solutions

Solution

2 weeks ago

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to cdubs

2 weeks ago

This is **erroneous**:

`if first.enrolid then `**index_dt=svcdate and enrolled_days_tot=**intck('days', enroll_end_dt, enroll_start_dt);

do you **mean something** like:

`if first.enrolid `**and** **index_dt=svcdate then enrolled_days_tot=**intck('days', enroll_end_dt, enroll_start_dt);

or

`if first.enrolid then do;`

index_dt=svcdate;

enrolled_days_tot=intck('days', enroll_end_dt, enroll_start_dt);

end;

I am only guessing.

All Replies

Solution

2 weeks ago

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to cdubs

2 weeks ago

This is **erroneous**:

`if first.enrolid then `**index_dt=svcdate and enrolled_days_tot=**intck('days', enroll_end_dt, enroll_start_dt);

do you **mean something** like:

`if first.enrolid `**and** **index_dt=svcdate then enrolled_days_tot=**intck('days', enroll_end_dt, enroll_start_dt);

or

`if first.enrolid then do;`

index_dt=svcdate;

enrolled_days_tot=intck('days', enroll_end_dt, enroll_start_dt);

end;

I am only guessing.

Highlighted
## Re: Why are dates changing -- and why is intck not generating a number

Options

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to novinosrin

2 weeks ago

ahh yes! The latter! I shall try that. Thank you!!