Hi guys, I am a beginner of SAS and I need some urgent helps. Based on this question, I need to create a SAS data set but I do not know how to proceed with the If-else statement. This data set consists of a header record for a household and immediately followed by one record for each household member if applicable. If the household doesn't consist of any members, the observation must not be included in the data set. What should I do in the if-else statement for the program to read the household and its corresponding members into one line of observation? How to ensure that the observation for household without members would be skipped ? It seems stupid but this is my code and I could not create the data set 😞 data Members;
infile datalines dlm=',';
input houseid :$15. @;
if houseid not in ('JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC') then do;
input type_house: $1. ;
end;
else if houseid in ('JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC') then do;
input birthdate: date11. hindicator$ gender$ marital$ education employment$ income;
end;
retain house_id type_house;
datalines;
A1234567BC012,A
15/FEB/1980,Y,Male,Married,3,FT,55000
3/JUN/1982,N,Female,Married,3,UE,0
24/JAN/2005,N,Male,Unknown,2,NA,0
D135EG023456789,B
19/OCT/1950,Y,Female,Divorced,0,PT,5000
X123A567F9,A
B2345234CC,A
21/MAY/1975,N,Male,Married,2,FT,30000
30/JUN/1978,Y,Female,Married,1,PT,10000
;
run; Your helps are much appreciated. Thank you !
... View more