Hi all,
First time user and still a newbie at SAS. I'm working on just basic descriptives on a dataset that contains 50+ variables with age in months (ageinmonths) as a variable ranging from 1 months to 120 months. The outcome variable contains two measurements: one is the age in months (ageinmonths_test) when a secondary questionnaire was administered, while another is a parallel of this but states the actual date (date_test) in YYMMDD10 format (ex. 2012-01-22 or January 22, 2012).
I wanted to know how to I can produce different datasets by restricting to only those ex:
1) between 10 months to 50 months
2) between 10 months to AT LEAST 8 months prior to their secondary questionnaire testing date
3) between 10 months to AT LEAST 4 months prior to their secondary questionnaire testing date
I've managed to do the first one through the code below:
data test1;
set original;
if ageinmonths <10 then delete;
if ageinmonths >50 then delete;
run;
However, I'm having trouble figuring out the 2nd and 3rd bits (most likely due to my lack of SAS knowledge). I've tried to do something similar as the code above but it didn't seem to work:
data test2;
set original;
if ageinmonths <12 AND ageinmonths_test <8 then keep;
else delete;
run;
In any case, any help would be much appreciated! Thanks in advance!