BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Astounding
PROC Star

Is this AGE1 that you are talking about?  16071 is probably the SAS equivalent of January 1 of some year.  

Mscarboncopy
Pyrite | Level 9

Sorry this is getting to be such a long question.

This age1 will give me a date and I am not sure this is what I wanted to do.

Creating a date for when each ID turned one does not help because I might not have that date in the visit_ages for some IDS.

Since we don't always have a visit for 1 year of age. Each ID has different ages, unfortunately. So if I am calculating age1 as the date for when each ID turns 1 what will happen for the IDS for which I don't have that date ?

 

Also my array is using variables VISIT_AGE not _VISIT_DATE.

 

I do have visit dates (but I might not have that 1 year old date) and I am using age variables so wouldn't it be better - and more importantly - is there a way for me to specify the following in the array ?

 
only if visit_age =< 1?
but this would need to be for all visit_ages Visit_age1 visit_age2 etc.  
 
If I need to pull out  antibiotics coded 1 (yes) only Up to 1 year of age and there is  way for me to specify the above in the array then  the OUTVARS in my array would only be generated IF AND only the ages were 1 or lower. 
 

 

The visit_ages are anywhere from 0.1 to 5.0 So the 25 visits can have a big range covered (unfortunately).

 

The ages are NOT the same for the visits. So Visit1_age could be 0.1 for one ID and 5.0 for another.  That is my issue with this data set.

 

Creating age1 is not doing that because it is creating a DATE (correct?) and that date might not be in my visit_date variables if I don' t have a visit when the child turned 1.
 
I used my visit_date variables to create the visit_age variables because I thought that would be easier. But for that I need a command that would specify this in the array command I have going. 
 
Thank you so much for your patience 🙂 
 
Astounding
PROC Star

Since you have visit date, you could easily calculate:

 

age_in_days = visit_date - dob;

 

That would be the age in days.  Is it important to you to determine whether a birthday has passed, so 365 days is not long enough because there might be a leap year?

 

Besides that, it looks like many of the remaining questions are logic ... what should happen rather than how to say it in SAS.  But I would be happy to examine questions where the logic is decided but how to say it in SAS is problematic.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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