I am having problems with the following in SAS:
I am investigating the association between parents marital status and childrens health status. I am investigating this in the time period of 1990-2005.
I can get information about parental marital status once every year - on Jan 1.
I can get information about the children continously.
So, in order to be as precise as possible, I would like to do the following:
If the child is born between Jan 1 and June 30 2000 (e.g) the information about parental marital status should be drawn on Jan 1 2000.
If the child is born between Jul 1 and December 31 2000 the information about parental marital status should be drawn on Jan 1 2001.
Also, you might find interest in using the MONTH function to test the month-of-year values 1-6 and set your some_important_date using INTNX with 'year' (not month as shown) with the third argument of 0 -- otherwise you would use a third argument of 1 (again with 'year') to increment to the next year's start-date.
format mybirthdate someotherdate date9.;
mybirthdate = '01aug2000'd;
if month(mybirthdate) le 6 then someotherdate = intnx('year',mybirthdate,0);
else someotherdate = intnx('year',mybirthdate,1);
Thank you - both of you - for your responses!
That was a big help.
However, I have faced a new problem and need som help again.
I am working with some variables, that have quite long names. The names of the variables are made out of numbers, and I only want to use the first two numbers in the variable name, when I run the analyses. How can i do that?
I have tried to write: temp_1=(substr(variablename,1,2);
but it doesnt seem to work. What am i doing wrong?