BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Dhana18
Obsidian | Level 7
/*Calculating timeframe between treatment and diagnosis*/
data CDCSTVST.CDC_Site_Timeframe;
set CDCSTVST.CDC_Site_SAS_Positive_Only;
days=(INTCK('days', colldate, Treatment_Date));
put days=;
run;

I am using the code above to calculate days between diagnosis and treatment. it is giving me . (blank) in days column.
please help
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

If I am understanding your reply above, you have a variable named TREATMENT_DATE1, but your code refers to TREATMENT_DATE which doesn't exist. Could that be it?

 

Please show us the LOG for this data step code (not just the ERROR or WARNING messages) by pasting the log as text into the window that appears when you click on the {i} icon.

--
Paige Miller

View solution in original post

4 REPLIES 4
novinosrin
Tourmaline | Level 20

A few things to consider and examine to why that's happening.

 

1. check whether your date variables are character or numeric. A proc contents will give you this information. If it is character. convert to numeric in a new assignment variable.

2. Looking at proc contents you could also determine whether your date variables are Datetime(number of seconds from jan 1,1960) values or date values(number of days from jan 1,1960) by looking at the format. If it is datetime use 'dtdays' interval. 

3. Check if there are missing values.

 

 

 

 

 

Dhana18
Obsidian | Level 7
Thank you for your quick response, both dates are MMDDYY10. Format
Alphabetic List of Variables and Attributes

#

Variable

Type

Len

Format

Label

1

IncidentID

Num

8

BEST.

IncidentID

7

Result

Char

58





5

Specimen

Char

12





6

TestType

Char

41





3

Treatment_Date1

Num

8

MMDDYY10.

Treatment_Date1

2

case

Char

8





4

colldate

Num

8

MMDDYY10.




novinosrin
Tourmaline | Level 20

Ok great. So it appears both are numeric SAS dates that are formatted as mmddyy10.  Have you checked for missing values? You could use a filter for missing and count. Determine the ratio of missing to non missing, and missing to total count.

 

Also @Dhana18 . Your proc contents report has Treatment_Date1 with 1 as suffix to the name while your code has Treatment_Date

days=(INTCK('days', colldate, Treatment_Date));

 

Is that a typo?

PaigeMiller
Diamond | Level 26

If I am understanding your reply above, you have a variable named TREATMENT_DATE1, but your code refers to TREATMENT_DATE which doesn't exist. Could that be it?

 

Please show us the LOG for this data step code (not just the ERROR or WARNING messages) by pasting the log as text into the window that appears when you click on the {i} icon.

--
Paige Miller

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 4 replies
  • 735 views
  • 0 likes
  • 3 in conversation