BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cdubs
Quartz | Level 8

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;
1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

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. 

View solution in original post

2 REPLIES 2
novinosrin
Tourmaline | Level 20

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. 

cdubs
Quartz | Level 8
ahh yes! The latter! I shall try that. Thank you!!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 743 views
  • 0 likes
  • 2 in conversation